Excel VBA Macro: Paste Range (Table) As Image In Email Body

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 พ.ย. 2024

ความคิดเห็น • 117

  • @ultimate_muu
    @ultimate_muu 8 หลายเดือนก่อน +1

    Thanks! Very helpful!
    I wanted to copy a table and paste the table in an email. I used the same code with minor changes.
    Code below for reference:
    del -->Set pic = ws.Pictures.Paste
    del -->pic.Cut
    change this line---> .PasteandFormat wdChartPicture
    to ---> .Paste

    • @greggowaffles
      @greggowaffles  8 หลายเดือนก่อน +1

      So glad you figured it out! Thank you so much!!!

    • @MrSweety143
      @MrSweety143 2 หลายเดือนก่อน

      I tried this but the table is not getting pasted on the mail body. Any addin has to be enabled?

  • @AvineshPal-t3m
    @AvineshPal-t3m 2 วันที่ผ่านมา

    This is great. I use the same code with minor changes. Very helpful. Thank you!

  • @fabriceramazani465
    @fabriceramazani465 ปีที่แล้ว +2

    Thank you Sir! I spent 3 hours trying to write a code in VBA to send an email with embedded image in the email body, but external parties to my organization could not view the image. Now I came across your simple method and it works. Man I like the internet, thank you !!!

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      So happy to hear that!! No problem!!

  • @anticlimactic165
    @anticlimactic165 ปีที่แล้ว

    Been searching the web for a working code and yours is the only one that worked.

  • @FusionBliss711
    @FusionBliss711 2 ปีที่แล้ว +1

    This code really saved me! In conjunction with your other send email video as well. Keep up the good work, hope to see more from you soon!

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว +1

      Thanks for that! It really means a lot!!

  • @5639didi
    @5639didi ปีที่แล้ว +4

    Great Video! By the way how to adjust the pic size that we have been copy and cut in outlook?

  • @arianelourenco153
    @arianelourenco153 3 หลายเดือนก่อน

    Thks, Saved my day!!!!!
    Great Job 👏

  • @ikemenman4995
    @ikemenman4995 2 ปีที่แล้ว

    First time I've seen a video of yours, it was quite helpful. Thank you, Greg.

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว

      You’re welcome! Thank you for the feedback.

  • @purenrg4life
    @purenrg4life 2 ปีที่แล้ว

    Loving your videos man! Cannot believe you don't have more subs! Keep it up.. you're a great teacher and it is so SO helpful to have you talk through what you are doing in each video! Thanks so much for your efforts in making them

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว

      Really appreciate that! Thank you so much!!

  • @saraielizabethesparzagarci3544
    @saraielizabethesparzagarci3544 3 ปีที่แล้ว +1

    Thanks so much for this video!! You made my day!!
    How do I add another table from a different sheet? 🤔

  • @epark9925
    @epark9925 ปีที่แล้ว

    Just subscribed love the way you walk us through your codes in simple terms. Can you do a video on how to copy and paste a filtered dynamic table with hidden columns as an image into the email html body? Your help will be much appreciated.

  • @mediamisfits3805
    @mediamisfits3805 2 ปีที่แล้ว +1

    You man are epic!

  • @FalconFlyer75
    @FalconFlyer75 2 ปีที่แล้ว

    much appreciated, exactly what I was looking for, Thanks

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว

      Awesome! Thanks for watching!!

  • @germanhamermiler1371
    @germanhamermiler1371 2 ปีที่แล้ว +2

    Hey! Good work. I have a question. When I run the macro The picture is pasted at the begining of the email and I need it at the bottom. How can i do it?

  • @puxhay
    @puxhay 3 หลายเดือนก่อน

    Thanks you 😊. What about to show the default signature in outlook?

  • @someidiotchild
    @someidiotchild ปีที่แล้ว +2

    How would we go about copying multiple ranges as images within the same email body?

  • @nhatanhnguyenhuu2745
    @nhatanhnguyenhuu2745 ปีที่แล้ว

    thank you !! your code help me alot !!

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      No problem! So glad to hear that!!

  • @Dinosword2000
    @Dinosword2000 ปีที่แล้ว

    Thank you VERY MUCH! 👍

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      No problem! Thank you for watching!!

  • @kimcelidonio9899
    @kimcelidonio9899 ปีที่แล้ว +1

    Hey greg, congrats for your videos.
    Its possible to resize the Image of the Range (table) in the email body?
    Thanks

    • @pessimistic5579
      @pessimistic5579 ปีที่แล้ว

      simply resize the table being copied in excel itself.

  • @qiyang1996
    @qiyang1996 2 ปีที่แล้ว +1

    Thank you for the tutorial! May i ask how to loop the function again to insert another table ?

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว

      no prob! thanks for watching!! im still looking into looping this code, but i have another video that essentially does the same thing. its just that the tables arent converted into images before being added to the email body: th-cam.com/video/9q8gZF0UOt8/w-d-xo.html

  • @csabalubloy7693
    @csabalubloy7693 2 ปีที่แล้ว +3

    Does anyone know why I receive run-time error 1004: Microsoft Excel cannot paste the data. at the following line: Set pic = ws.Pictures.Paste? If I press again on running the code it prepares the email, but at first it stucks always.

  • @matheusgameiro61
    @matheusgameiro61 10 หลายเดือนก่อน

    amazing, bro!
    thanks

  • @nikkiebrown2639
    @nikkiebrown2639 3 ปีที่แล้ว

    This video made my entire day! Can you show how you would resize the chart?

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      absolutely! apologies for the delay. hope this video helps: th-cam.com/video/MEi1m9h9L58/w-d-xo.html

  • @jeffmiller4405
    @jeffmiller4405 ปีที่แล้ว

    You are amazing!!!!

  • @HugoPinheiroBorba
    @HugoPinheiroBorba ปีที่แล้ว

    Thank you a lot, it will help a lot :D

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว +1

      I hope it does help! Thank you for watching!!

  • @asgerlarsen2083
    @asgerlarsen2083 ปีที่แล้ว

    Great video!
    Is it possible to copy and paste multiple tables as picture format?
    I have watched your other video that uses RangetoHTML to paste tables, but unfortunately this work poorly when pasting PivotTables, it struggles with the formatting.
    The method of pasting the ranged as a picture solves this problem, now I just need to be able to paste multiple ranges into the same email.
    Thanks for the help so far!

  • @jeromeradtke3015
    @jeromeradtke3015 2 ปีที่แล้ว

    great video, thank you.:)

  • @Pokemoncharlizard
    @Pokemoncharlizard 5 หลายเดือนก่อน

    What if there are 2 table pictures that we need to attached from 2 different tabs? Thank you for your help in advance.

  • @manuelcalderon8482
    @manuelcalderon8482 2 ปีที่แล้ว +1

    Great Tutorial, Greg!!! thank you so much :)
    May I ask how would you increase the size of the pic on the email?

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว +1

      No prob! Thanks for watching! Hope this video helps: th-cam.com/video/asznNmwOAT8/w-d-xo.html

    • @nathanwhite7268
      @nathanwhite7268 2 ปีที่แล้ว +1

      @@greggowaffles hey this video is great. How can I increase the size of this pic in the body of the email (where you copy and cut it from excel). I have looked at your other video where you do this but with a png that is saved in a file location, however I can't seem to get it to work with the excel sheet image.

    • @denzelgohh
      @denzelgohh 2 ปีที่แล้ว +1

      asking the same qn! The vid is resizing png, doesn’t seem to work for excel image

    • @gurpreetkaur-gd8np
      @gurpreetkaur-gd8np 2 ปีที่แล้ว

      Same question! issue in the size of image

    • @jasmadsen
      @jasmadsen 2 ปีที่แล้ว

      Has anybody ever found a solution to realize the table image in the body of the email?

  • @fatihakben6369
    @fatihakben6369 6 หลายเดือนก่อน

    Hi Greg, This works almost perfectly! Except the ".HTML" and ."PasteandFormat wdChartPicture" both clobber everything else previously entered. Any Ideas? The

  • @pessimistic5579
    @pessimistic5579 ปีที่แล้ว

    This is great and works lovely, but i found that the code breaks when you replace .Display with .Send in the outmail with block. i want the email to send automatically without the outlook window popping up. is there a workaround?

  • @ramrosales447
    @ramrosales447 2 ปีที่แล้ว

    Thanks Greg. It works awesomely fine. Question though. Can we resize the attached range pic via "with pic"?

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      yes! apologies for the delay. hope this video helps: th-cam.com/video/MEi1m9h9L58/w-d-xo.html

  • @everteero5305
    @everteero5305 3 ปีที่แล้ว

    Great video! Can you also make a video that shows how to pull distance info between 2 locations written in the cell from Bing Maps API into excel?

  • @graywolfweb1361
    @graywolfweb1361 2 ปีที่แล้ว

    This is fantastic. I was struggling with how to do exactly this. Found other code but that code was WAY too complicated.
    Only thing I need to figure out is how to get my default signature to populate. If you have a suggestion that would be great.
    Gray.

    • @jaysekhon8014
      @jaysekhon8014 2 ปีที่แล้ว +1

      Open up Outlook. Go to File, Options, Mail, then click Editor Options under Compose Messages. Then Click Advanced, scroll down to the Insert/Paste pictures as: and select Square. See if that fixes your problem (:

  • @kenshinyusuke
    @kenshinyusuke 2 ปีที่แล้ว +1

    Is there a solution for doing this twice in one email?

  • @ivanarciniegas7324
    @ivanarciniegas7324 ปีที่แล้ว

    thank you!🥰

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      You’re welcome!! Thank you for watching!!

  • @dennisprada945
    @dennisprada945 2 ปีที่แล้ว

    Hi Greg! What if I need to Paste Range AS Image in Mail Body but this range is not a Tablet but a mix of graphic?

  • @kingLostSouls
    @kingLostSouls 2 ปีที่แล้ว

    This is a great example however I when I adapted my code to use the picture appears after my signature. My code previously would generate a pdf and then create the HTMLbody to have some text and my signature. Any ideas?

  • @tekygenie
    @tekygenie 2 ปีที่แล้ว

    Hey Greg
    Thank you so much for sharing these VBA tutorials. Helped me a lot to create one of my own.
    One help from you
    Instead of pasting in email, how can I export this image to a path

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว

      glad to hear that! thanks for watching! if you google SaveRangeAsPicture you should find some good stuff. ill make a video on this in the near future

    • @tekygenie
      @tekygenie 2 ปีที่แล้ว

      @@greggowaffles thank you again!!

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว

      No problem!

  • @michelledelrosario5610
    @michelledelrosario5610 2 ปีที่แล้ว +1

    Hello sir. This absolutely works! Thank you! Although, when pasted in outlook, the image version of my selected range becomes small. Is there any way I could set the size of the image in outlook using vba? Thank you!

    • @timothyclayton2573
      @timothyclayton2573 2 ปีที่แล้ว

      i noticed the same problem.

    • @MrSweety143
      @MrSweety143 2 หลายเดือนก่อน

      ​@@timothyclayton2573any solution to this problem

  • @aaronjohnson2215
    @aaronjohnson2215 2 หลายเดือนก่อน

    Is it possible to just display this pictures as popup so user can copy?😊

  • @fazlifantom9233
    @fazlifantom9233 ปีที่แล้ว

    @greggowaffles how to Paste Range (Table) in email using different excel.
    I have multiple excel workbook, which have 1 table per customer. Is it possible to copy and paste from the workbook to the email body as range/table format?

  • @christophwissing4877
    @christophwissing4877 ปีที่แล้ว

    Very nice video . I used the code but my image is not in the new email automatically . I do the Strg v to get the image in the email. What is my mistake ?

  • @harilibo
    @harilibo 2 ปีที่แล้ว

    just awesome!

  • @aksharkesari2299
    @aksharkesari2299 2 ปีที่แล้ว

    This is amazing, Greg! Just one query, the image is overriding my Signature. Is there a way to fix it? Thanks

    • @jaysekhon8014
      @jaysekhon8014 2 ปีที่แล้ว

      Open up Outlook. Go to File, Options, Mail, then click Editor Options under Compose Messages. Then Click Advanced, scroll down to the Insert/Paste pictures as: and select Square. See if that fixes your problem (:

  • @kreamypie
    @kreamypie 9 หลายเดือนก่อน

    What if i have multiple work sheets and i only want to grab the raange of the work sheet that i am currently on and convert it to image?

  • @drewandres6359
    @drewandres6359 ปีที่แล้ว

    what is the code to paste range as images for two tables in the same sheet? thanks

  • @kayepatrick5809
    @kayepatrick5809 ปีที่แล้ว

    do you have ways how to add a link to the image pasted in the email body?

  • @tonyod.1161
    @tonyod.1161 2 ปีที่แล้ว +1

    Hi, great tutorial! However, our version is probably different, I can't define something as Picture in VBA... I tried Image and Graphic instead, but it give me a type mistmatch error. Anyone have an idea what can I use instead?

    • @denzelgohh
      @denzelgohh 2 ปีที่แล้ว

      Same question here! Do let us know Greg!

  • @anferneechen6232
    @anferneechen6232 ปีที่แล้ว

    I tried the exact same codes but it only creates an email with To: and Subject: Why is the body blank?

  • @joshuatravatello1805
    @joshuatravatello1805 2 ปีที่แล้ว

    I keep getting Run-time error '429': ActiveX component can't create object!!! Do you have any advice, I've been breaking my head trying to figure this out.

  • @ianlafferty2264
    @ianlafferty2264 2 ปีที่แล้ว

    Very very new to VBA, learning a lot from these videos.I keep getting a compile error: Method or data member not found? Seems to stop at Pic.Cut. Suggestions anyone?

  • @ThePlatinumaster
    @ThePlatinumaster ปีที่แล้ว

    Can I paste the image into a different range?

  • @robertomonteiro4713
    @robertomonteiro4713 ปีที่แล้ว

    Hi, I need to copy 2 differents grafics in 2 differents sheets, how can I do?

  • @stephenjhayes83
    @stephenjhayes83 2 ปีที่แล้ว

    newbie here, how to run this on a button?

  • @hhouston7181
    @hhouston7181 2 ปีที่แล้ว

    Hi, how would you increase the size of the pic on the email?

  • @nicingram1719
    @nicingram1719 2 ปีที่แล้ว

    Is there any way I can paste a range of cells that are non contiguous?

  • @timothyclayton2573
    @timothyclayton2573 2 ปีที่แล้ว

    This works great Except the pasted image is very small. Too small to read. Is there an easy way to enlarge this?

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      yes! apologies for the delay. hope this video helps: th-cam.com/video/MEi1m9h9L58/w-d-xo.html

  • @vivekkrishnagrawal889
    @vivekkrishnagrawal889 ปีที่แล้ว

    How to paste multiple range as picture ?

  • @minhtrungtran3675
    @minhtrungtran3675 4 หลายเดือนก่อน

    Code debug at "set pic=ws.pictures.paste" with error Run time 1004. Can everyone help me?

  • @JoaoVaralta
    @JoaoVaralta ปีที่แล้ว

    Man, thanks for the video. I’m having and issue and I don’t know how to solve. It pastes nothing on the email body when I run the code. But if I press Ctrl+V I can paste the range on email body. How can I solve this?

    • @jefflunsford1331
      @jefflunsford1331 ปีที่แล้ว +1

      Same here….

    • @JoaoVaralta
      @JoaoVaralta ปีที่แล้ว

      @@jefflunsford1331 man I wish I could help you but I don’t remember how I solved it. Try copying and pasting your script on chat gpt explaining you error. Maybe it could help you.

  • @kontara
    @kontara 2 ปีที่แล้ว +1

    Thanks!

    • @greggowaffles
      @greggowaffles  2 ปีที่แล้ว +1

      Thank you so much! I really appreciate it!!

  • @MrJcole0502
    @MrJcole0502 6 หลายเดือนก่อน

    This pastes the image when you display the picture without sending but when you change .display to .send, it sends it without the image. Has anyone figure this one out yet?

  • @LG-pv8kr
    @LG-pv8kr 6 หลายเดือนก่อน

    Great video,but it doesn't paste the Pic...😅

  • @balasubramaniandharmalinga5723
    @balasubramaniandharmalinga5723 ปีที่แล้ว

    Hi Greg, How can we add multiple tables to outlook?

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      Hope this helps! th-cam.com/video/9q8gZF0UOt8/w-d-xo.html

    • @asgerlarsen2083
      @asgerlarsen2083 ปีที่แล้ว

      @@greggowaffles Is it possible to add multiple tables, but pasted as pictures?

  • @seanharper1314
    @seanharper1314 3 ปีที่แล้ว

    Can you automatically press send then move to the next worksheet?

    • @seanharper1314
      @seanharper1314 3 ปีที่แล้ว

      And do this until you get to the last worksheet

  • @Alexkip2008
    @Alexkip2008 2 ปีที่แล้ว

    Hi i've got an error 424 on line Set OutMail = OutApp.CreateItem(0)

    • @Alexkip2008
      @Alexkip2008 2 ปีที่แล้ว

      sorry my fault .. it works :)

  • @DiLombardi
    @DiLombardi 9 หลายเดือนก่อน

    pic.cut gives an error, has anyone figured it out?

  • @changhi3743
    @changhi3743 2 ปีที่แล้ว

    This code does not work. It either uses methods that don't exist anymore or variables not declared.

  • @fishermansdirect1631
    @fishermansdirect1631 11 วันที่ผ่านมา

    QUESTION, what’s the difference between doing this and copying a snip of the Excel sheet into an Outlook email?

    • @greggowaffles
      @greggowaffles  11 วันที่ผ่านมา

      This streamlines the entire process by combining the steps of copying the snippet and drafting the email into one seamless action. It can also integrate with other macros to accomplish even more tasks simultaneously, reducing time and eliminating human error

  • @nicholaslorenzo8120
    @nicholaslorenzo8120 3 หลายเดือนก่อน

    when I tried to use this line of code at work, I had pic.cut launch a massive stack of code that took a few minutes to run. Does anyone else have this same problem?

  • @MichaelVargas
    @MichaelVargas 2 ปีที่แล้ว

    @greggowaffles Great video, easy to follow.
    Do you know how to add the information as table instead of image?. Also, how can I add data from specific cell into the subject line?.
    This is the code that I have:
    Sub Send()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim table As Range
    Dim pic As Picture
    Dim ws As Worksheet
    Dim wordDoc
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    'grab table, convert to image, and cut
    Set ws = ThisWorkbook.Sheets("Form")
    Set table = ws.Range("B4:C21")
    ws.Activate
    table.Copy
    Set pic = ws.Pictures.Paste
    pic.Cut
    'create email message
    On Error Resume Next
    With OutMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Credit Review for" & "" & Range("C4") & "" & Range("C6")
    .Display

    Set wordDoc = OutMail.GetInspector.WordEditor
    With wordDoc.Range
    .PasteandFormat wdChartPicture
    .insertParagraphAfter
    .insertParagraphAfter
    .InsertAfter "Regards,"
    .insertParagraphAfter
    End With

    .HTMLBody = "Hello Risk Management, Could you please run a credit review of this location? " & .HTMLBody
    End With
    On Error GoTo 0

    Set OutApp = Nothing
    Set OutMail = Nothing
    End Sub

  • @AlexWigal
    @AlexWigal ปีที่แล้ว

    When I run the code, I get a Run-time error '9':
    "Subscript out of range"
    When I select debug, it highlights "Set ws = ThisWorkbook.Sheets("EOSReport")"
    Any insight? Thank you!!

    • @greggowaffles
      @greggowaffles  ปีที่แล้ว

      Maybe there’s a space “ “ in the tab name