Тёмный

Excel VBA Macro: Send Email With Table In Body (Dynamic Range) 

greggowaffles
Подписаться 6 тыс.
Просмотров 108 тыс.
50% 1

RangetoHTML Function: Please refer to the pinned comment for the actual code, as this function has been removed from the original website (www.rondebruin....)
Excel VBA Macro: Send Email With Table In Body (Dynamic Range). In this video we go over how to send an email with a table/range in the body of the message using the RangetoHTML function.
#ExcelVBA #ExcelMacro

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 336   
@greggowaffles
@greggowaffles Месяц назад
Thank you for informing me about the removal of the RangetoHTML function from the website. Please find the code below: Function RangetoHTML(rng As Range) ' Changed by Ron de Bruin 28-Oct-2006 ' Working in Office 2000-2016 Dim fso As Object Dim ts As Object Dim TempFile As String Dim TempWB As Workbook TempFile = Environ$("temp") & "\" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm" 'Copy the range and create a new workbook to past the data in rng.Copy Set TempWB = Workbooks.Add(1) With TempWB.Sheets(1) .Cells(1).PasteSpecial Paste:=8 .Cells(1).PasteSpecial xlPasteValues, , False, False .Cells(1).PasteSpecial xlPasteFormats, , False, False .Cells(1).Select Application.CutCopyMode = False On Error Resume Next .DrawingObjects.Visible = True .DrawingObjects.Delete On Error GoTo 0 End With 'Publish the sheet to a htm file With TempWB.PublishObjects.Add( _ SourceType:=xlSourceRange, _ FileName:=TempFile, _ Sheet:=TempWB.Sheets(1).Name, _ Source:=TempWB.Sheets(1).UsedRange.Address, _ HtmlType:=xlHtmlStatic) .Publish (True) End With 'Read all data from the htm file into RangetoHTML Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2) RangetoHTML = ts.ReadAll ts.Close RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _ "align=left x:publishsource=") 'Close TempWB TempWB.Close savechanges:=False 'Delete the htm file we used in this function Kill TempFile Set ts = Nothing Set fso = Nothing Set TempWB = Nothing End Function
@AzharAli-zn4rj
@AzharAli-zn4rj 3 года назад
HTMLbody is not working in my outlook 16 client
@maxfeeney7277
@maxfeeney7277 8 месяцев назад
this is absolutely brilliant! thank you for your videos - any chance you may be able to help with formatting? my automatic Outlook signature by degault appears between the table and the “thanks, Greg” part! weird
@greggowaffles
@greggowaffles 4 года назад
Send Email With Multiple Tables In Body (Static and Dynamic Ranges): ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9q8gZF0UOt8.html
@NewAgeWisdom1
@NewAgeWisdom1 3 года назад
I love the content. Mine did not work although i follow the instructions. Not sure why. When i run it, error message " ActiveX Component Can't create object" Pops up.
@ashwinsundar7866
@ashwinsundar7866 3 года назад
Hi this really worked out well,but while the excel data is copied to the outlook, the table borders of the excel data is not appropriate...
@francoispo1481
@francoispo1481 Год назад
error RangetoHTML(pop) not defined - excel 2013
@Joske920
@Joske920 7 месяцев назад
Hi, just a FYI the count_row is now variant instead of integer. str1 as well. Always add the variable type for each variable bacause this could lead to weird error's in some cases
@franksuarez1023
@franksuarez1023 Год назад
This is one of the best videos I´ve ever seen about this process! Thanks a million for this amazing contribution. You deserve more thumbs up!!!
@greggowaffles
@greggowaffles Год назад
I really appreciate that feedback! Thank you so much!!
@Diamond-Daga
@Diamond-Daga 4 месяца назад
Thank you Greg for this video, this is what I was looking for. I tried to replicate the same but getting an error Error "Run-time error 1004, Application-defined or object-defined error" in the line Set pop = Sheets("Form").Range(Cells(1, 1), Cells(count_row, count_col)) is it possible to share this file please :)
@AdamVirgile34
@AdamVirgile34 9 месяцев назад
Do you have a file with this VBA code that you could share with me, please? Ron took down his code.
@jidelk
@jidelk 4 года назад
Bro, I can't express with words how much I'm loving you right now xD It's 2:15 in the morning and you just saved my life. THANK YOU!
@greggowaffles
@greggowaffles 4 года назад
No problem! So glad to hear that!!
@benallen9893
@benallen9893 2 года назад
This works really well, thank you for sharing! One issue I have is that the code only works when the sheet is active, for example the Population sheet needs to be active for the code to work, if I select an another sheet or hide it I get a Run-time error '1004':. Do you know a way to fix this? Thank you once again.
@Rolod
@Rolod Год назад
Did you ever find a solution to this problem? I have the same issue.
@RodrigoAdriano
@RodrigoAdriano Год назад
​@@Rolod Maybe.. create a new dynamic "" manually with "FOR" and "Count Rows / Cols"
@naveenofficial8754
@naveenofficial8754 2 года назад
Sub function denied
@kHoPhAe
@kHoPhAe 8 месяцев назад
Any alternative links? Someone pissed off Ron and he scrubbed his site
@tiffchy
@tiffchy 2 года назад
hi greg! thanks so much for this tutorial, it is certainly very helpful. some of the content in my tables are full sentences and some words are cut off. is there any other way that i can refer to the cells so that texts in combined cells can be sent as well? thanks!
@iwonawrobel4556
@iwonawrobel4556 3 года назад
Hi, it works fine, thank you! The only issue I face is that it cuts off the last row of the table and the table is therefore incomplete within the email (I have only 4 rows in total and it is showing only 3 of them). Not sure what is the reason.
@RajeshAttada007
@RajeshAttada007 4 года назад
This content made my day. This is what I am exactly looking for.. from couple of weeks. Greg... Your explanation is like, friend explaining things... Lots of love from me ...to you. Thank You so much for this help, subscribed, liked, commented and will be looking forward to consume more knowledge from you. All the best for your future endeavors.
@greggowaffles
@greggowaffles 4 года назад
Thank you! I'm so glad to hear that! I'm looking forward to providing more content for you
@matanubhav1
@matanubhav1 3 года назад
This is Helpful. Can you help with a code which can be used to send multiple emails with different tables. Appreciate your help.
@greggowaffles
@greggowaffles 3 года назад
thanks! yes, I'll make a video on this soon
@daniellealmodiel5964
@daniellealmodiel5964 2 месяца назад
Site is no longer working, can someone please share the code huhu
@psI6
@psI6 Месяц назад
Anyone know where I can find this code? The website has been changed and is no longer offering help. If possible, could someone copy / paste in a reply. Thanks!
@greggowaffles
@greggowaffles Месяц назад
here you go! Function RangetoHTML(rng As Range) ' Changed by Ron de Bruin 28-Oct-2006 ' Working in Office 2000-2016 Dim fso As Object Dim ts As Object Dim TempFile As String Dim TempWB As Workbook TempFile = Environ$("temp") & "\" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm" 'Copy the range and create a new workbook to past the data in rng.Copy Set TempWB = Workbooks.Add(1) With TempWB.Sheets(1) .Cells(1).PasteSpecial Paste:=8 .Cells(1).PasteSpecial xlPasteValues, , False, False .Cells(1).PasteSpecial xlPasteFormats, , False, False .Cells(1).Select Application.CutCopyMode = False On Error Resume Next .DrawingObjects.Visible = True .DrawingObjects.Delete On Error GoTo 0 End With 'Publish the sheet to a htm file With TempWB.PublishObjects.Add( _ SourceType:=xlSourceRange, _ FileName:=TempFile, _ Sheet:=TempWB.Sheets(1).Name, _ Source:=TempWB.Sheets(1).UsedRange.Address, _ HtmlType:=xlHtmlStatic) .Publish (True) End With 'Read all data from the htm file into RangetoHTML Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2) RangetoHTML = ts.ReadAll ts.Close RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _ "align=left x:publishsource=") 'Close TempWB TempWB.Close savechanges:=False 'Delete the htm file we used in this function Kill TempFile Set ts = Nothing Set fso = Nothing Set TempWB = Nothing End Function
@jackshearer1666
@jackshearer1666 3 года назад
Great Video, I have data that starts in Cell A18, do I need to make any changes to the code that you have used?
@greggowaffles
@greggowaffles 3 года назад
Thanks! Yeah, for the count_row and count_col lines, you’ll need to change where it says “A1” to “A18”
@tramanand
@tramanand 3 месяца назад
Terrificc...thanks a ton!!! 🙏🙏
@JhonDamasco
@JhonDamasco 2 года назад
Does the Range to HTML function works in Excel 2019?
@turb0gate
@turb0gate 10 месяцев назад
Great Tutorial. Question if anyone sees this. When I run it to test, it opens up the email, but then launches another instance of excel and displays the table there, not in the email body. Does anyone know what I may be doing wrong? Thx.
@martinj9285
@martinj9285 2 года назад
Hi Greeg, I need to insert the png image file into the mail body....I have tried it.The only a blank mail which I was getting..Even I am using .HTMLBody = "" or Folder path also given. Nothing is happend.. Can u plz help me on this?😇
@michelleyeo2584
@michelleyeo2584 3 года назад
Hi Greg, thanks for this useful tutorial. do you have a video showing how I can filter a table, and vlookup a table on another sheet with the corresponding email addresses? for example in your table, i want to send any rows with China to email address 1 and rows with India to email address 2.
@moniruzzamanshohag
@moniruzzamanshohag Год назад
I want to copy the excel range to send an email respect to the current date. Example: The table range is A1:D20 Column A for Date. Now I want to copy the range A5:D9 to send an email body, A5 to A9 cell value are current date.
@denizschecter
@denizschecter 2 года назад
Thanks but it is not working in my excel. it is 2019. do you have updated code?
@brittaniguidry6061
@brittaniguidry6061 3 месяца назад
Ron's site is no longer available... can you paste the code somewhere so I can copy it?
@greggowaffles
@greggowaffles Месяц назад
here you go! Function RangetoHTML(rng As Range) ' Changed by Ron de Bruin 28-Oct-2006 ' Working in Office 2000-2016 Dim fso As Object Dim ts As Object Dim TempFile As String Dim TempWB As Workbook TempFile = Environ$("temp") & "\" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm" 'Copy the range and create a new workbook to past the data in rng.Copy Set TempWB = Workbooks.Add(1) With TempWB.Sheets(1) .Cells(1).PasteSpecial Paste:=8 .Cells(1).PasteSpecial xlPasteValues, , False, False .Cells(1).PasteSpecial xlPasteFormats, , False, False .Cells(1).Select Application.CutCopyMode = False On Error Resume Next .DrawingObjects.Visible = True .DrawingObjects.Delete On Error GoTo 0 End With 'Publish the sheet to a htm file With TempWB.PublishObjects.Add( _ SourceType:=xlSourceRange, _ FileName:=TempFile, _ Sheet:=TempWB.Sheets(1).Name, _ Source:=TempWB.Sheets(1).UsedRange.Address, _ HtmlType:=xlHtmlStatic) .Publish (True) End With 'Read all data from the htm file into RangetoHTML Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2) RangetoHTML = ts.ReadAll ts.Close RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _ "align=left x:publishsource=") 'Close TempWB TempWB.Close savechanges:=False 'Delete the htm file we used in this function Kill TempFile Set ts = Nothing Set fso = Nothing Set TempWB = Nothing End Function
@pubgnoobs8415
@pubgnoobs8415 Год назад
How to make this dynamic with To and Cc
@wasihassan8089
@wasihassan8089 2 года назад
What if I want to insert Country names in Subject by obtaining from Sheet? What if I want to send the same mail on more than 1 e-mail ID in "To" and "Cc"?
@lulatalula314
@lulatalula314 10 месяцев назад
Can you post code for module 2 I cannot
@nareshchakowry7687
@nareshchakowry7687 2 года назад
Hello, does it work with office 365 plz? No error when running the code but no email generated
@dachhisudarshan3206
@dachhisudarshan3206 4 года назад
very useful.... can you also please suggest what code to use if the table has to be filtered and only the filtered rows to be displayed in the mail body??
@greggowaffles
@greggowaffles 4 года назад
thanks. you can filter, and copy the visible values to another sheet, and then use that sheet to pass through the RangeToHTML function. I show how to copy filtered values to another sheet in this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-dEAozqfZFHE.html
@salimkoc4254
@salimkoc4254 Год назад
Hello, I want to export the selected area as jpeg or png in Excel. Can you help me. Thank you.
@kenmei4453
@kenmei4453 Год назад
I copy the exact same code as yours, but if shows run time error '424' object require.
@souravmallick4688
@souravmallick4688 3 года назад
Hi Greg, Thanks a lot for making this video. But I am facing a problem whenever my range is more than 45 rows. It seems like the function is copying the range in proper format till 45 rows. After that it is not working properly.Do you have any solution for that?
@greggowaffles
@greggowaffles 3 года назад
no problem! im not seeing that happen when i try to recreate that scenario. what format differences are you seeing?
@janicemoe2585
@janicemoe2585 2 года назад
First this vidoe solve the problem of mine half way. May I know how do I send to multiple emails with table in body?
@byranmullins3505
@byranmullins3505 Год назад
Thank you for this! Trying to figure out how to send emails thru excel vba containing static data but to a certain group that is static and could change, any idea??
@23Antanas
@23Antanas 2 месяца назад
RangetoHTML Function link not working
@greggowaffles
@greggowaffles Месяц назад
here you go! Function RangetoHTML(rng As Range) ' Changed by Ron de Bruin 28-Oct-2006 ' Working in Office 2000-2016 Dim fso As Object Dim ts As Object Dim TempFile As String Dim TempWB As Workbook TempFile = Environ$("temp") & "\" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm" 'Copy the range and create a new workbook to past the data in rng.Copy Set TempWB = Workbooks.Add(1) With TempWB.Sheets(1) .Cells(1).PasteSpecial Paste:=8 .Cells(1).PasteSpecial xlPasteValues, , False, False .Cells(1).PasteSpecial xlPasteFormats, , False, False .Cells(1).Select Application.CutCopyMode = False On Error Resume Next .DrawingObjects.Visible = True .DrawingObjects.Delete On Error GoTo 0 End With 'Publish the sheet to a htm file With TempWB.PublishObjects.Add( _ SourceType:=xlSourceRange, _ FileName:=TempFile, _ Sheet:=TempWB.Sheets(1).Name, _ Source:=TempWB.Sheets(1).UsedRange.Address, _ HtmlType:=xlHtmlStatic) .Publish (True) End With 'Read all data from the htm file into RangetoHTML Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2) RangetoHTML = ts.ReadAll ts.Close RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _ "align=left x:publishsource=") 'Close TempWB TempWB.Close savechanges:=False 'Delete the htm file we used in this function Kill TempFile Set ts = Nothing Set fso = Nothing Set TempWB = Nothing End Function
@ashwinsundar7866
@ashwinsundar7866 3 года назад
Hi,that was helpful. But while getting the data from Excel to outlook,the excel table is not appropriate,->the bottom line of the table is not coming in outlook.need to expand it manually,is there any way to rectify that....
@Youniversal.
@Youniversal. 3 года назад
I get the compile error: Sub or Function not defined... This is due to the function RangetoHTML(pop)... Can anyone help me out
@greggowaffles
@greggowaffles 3 года назад
You have to copy and paste the RangetoHTML function code from the site in the description
@cybermike33
@cybermike33 2 года назад
Is there a way to trigger this email from a Button in another part of the spreadsheet? Currently unless I'm in the sheet with the data, it will not send. It just bugs.
@AzharAli-zn4rj
@AzharAli-zn4rj 3 года назад
HTMLbody is not working in my outlook 16 client
@skhussain4965
@skhussain4965 11 месяцев назад
Hey greg, What i want to use filter and send mail to each recipient based on the filter till the last recipient?
@siddharth9643
@siddharth9643 2 месяца назад
Hi bro i need your help
@arulmozhikarunanidhi1948
@arulmozhikarunanidhi1948 2 года назад
Hey i have one doubt i want to send excel first row and one another row which will change according to the person name is there any code to specify that
@johnromualdruiz1876
@johnromualdruiz1876 3 года назад
do you have something that works with office 365
@romankaz3520
@romankaz3520 2 года назад
Hey great tutorial, very helpful. My Sheet consists of a Query with a Join out of 2 seperate Excel Sheets. I have a filter in this query for example filtering a country but when I want to send the E-Mail there is no filtering in the email. Can you help me fix this problem? I need to send a report to 10 countries for example and each email needs to have different receiver and different table based on the same data but with different filters. Thank you
@wellwisher4905
@wellwisher4905 2 года назад
Hello, What if the table starts from somewhere in between not from A1 cell. Then in this case what to do ?
@sarahcrafton3723
@sarahcrafton3723 3 года назад
Hi, this code was very helpful! Only hiccup was when I ran it, the formatting did not copy to the email, can you help with this?
@prajinoo
@prajinoo 4 года назад
Hey! This came really handy. Thanks for the video. I have one question - Is it possible to copy a specific range from a pivot table where the data I want starts from A4 (it's a dynamic range) and the rows above it are 2 report filters and one blank row. I tried the below code count_row = WorksheetFunction.CountA(Range("A4", Range("A4").End(xlDown))) count_col = WorksheetFunction.CountA(Range("A4", Range("A4").End(xlToRight))) Set Pmtstat = Sheets("PIVOT").Range(Cells(4, 1), Cells(count_row, count_col)) I got an output that did not display the last 3 rows of the range that I wanted. Please help!
@greggowaffles
@greggowaffles 4 года назад
Hi! just add "+3" to count_row and your problem will be solved :-) count_row = WorksheetFunction.CountA(Range("A4", Range("A4").End(xlDown))) + 3
@prajinoo
@prajinoo 4 года назад
@@greggowaffles It worked! Thanks :)
@greggowaffles
@greggowaffles 4 года назад
@@prajinoo no prob!
@ronniel.jacinto
@ronniel.jacinto 3 года назад
Hi- what code if you want some of the words in body of email to be in bold letters? thank you
@greggowaffles
@greggowaffles 3 года назад
You can check this video out: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-7yGBjNBydEY.html
@ronniel.jacinto
@ronniel.jacinto 3 года назад
Thank you ❤️ this is a big help 🤗
@greggowaffles
@greggowaffles 3 года назад
@@ronniel.jacinto no problem! Glad to hear that!! ☺️
@conniewhitehouse.arteaga2910
@conniewhitehouse.arteaga2910 2 года назад
Can instead of a static table what if 8 want to have it pull all lines in a range that meet a criteria? Is that possible?
@desimortal1584
@desimortal1584 3 года назад
Thanks this is really helpful… is there a way we can copy specific info from the table and put it in the Subject line? If not can we put a msg box before user hits send an email within same macro?
@rosebellbicar1125
@rosebellbicar1125 2 года назад
Hi, new sub here. Your videos are amazing. By any chance, do you have one in google sheets?
@abiyex1
@abiyex1 2 года назад
Hi Gregg! Question: Is it possible to send an email that has Pdf attachments and a table in the body?
@MrEliseo0808
@MrEliseo0808 Год назад
Hi , i find your videos really helpful , i was able to do this macro with your instructions , i had and image in the top row of the table but it did not show in the email , checking your videos i found send email with table as image but i was wondering if that is the only way to have the image shown in the email on the top row of the table or if i can avoid making the table a picture.
@jesuseduardobittersuarez7517
@jesuseduardobittersuarez7517 3 года назад
SOMEbody write this down, it gives me an error afetr &_ HELPPPPPPPPPP
@greggowaffles
@greggowaffles 3 года назад
change &_ to & _
@nitish1271
@nitish1271 Год назад
Hello Greg, This video was great.. Infact I was looking for such video on RU-vid since last 2 days.. Finally I found yours's the correct one. However I had one query, how to create space between the two strings? Cuz when I tried it from my end, the str2 is touching the table which I had. How can we create a space between str2 and the table which is inserted? Thanks
@greggowaffles
@greggowaffles Год назад
Glad to hear that! You can just add “ “ & in between the & and str2 to add a space between str2 and the table. Hope that helps!!
@ElCharlieChin
@ElCharlieChin 3 года назад
Thank you very much, it works! Do you know how to send the email without having to use the ".Display" code? I'm trying to send it replacing it with ".Send" but it doesn't work.
@greggowaffles
@greggowaffles 3 года назад
glad to hear that! there are couple workarounds here: stackoverflow.com/questions/41724452/send-not-working-vba-but-display-is hope it helps!
@manojkaliaperumal968
@manojkaliaperumal968 2 года назад
Hi is it possible to use the same code but send only a specific row like say from C5 to D8 which has 3 rows in it and columns of 2 ? Is that possible
@greggowaffles
@greggowaffles 2 года назад
Hi! Yes, you can specify that in the code. You can set row count and column count equal to actual numbers
@steveagra4150
@steveagra4150 Год назад
Glad, I found this! Thank you
@massimilianodipaolo2780
@massimilianodipaolo2780 2 года назад
Hi Greg! This video is amazing, but I do have a problem with the macro: when I launch it, a compile error related to "RangetoHTML(pop)" pops up. It says that I have to define the range! How can I fix?
@wellwisher4905
@wellwisher4905 2 года назад
Hello, What if the table starts from somewhere in between not from A1 cell. Then in this case what to do ?
@shahidSag
@shahidSag 4 года назад
Hey,is it possible to send emails if there is conditions! Exp: if range ("A4")= "true" then Range ("b4:f6"). select Selection.copy So the .body="good morning" For the above code it's working fine if I change the condition to false it's showing the same good morning I want change that to good evening if range ("A4")= "false" then Range ("b4:f6"). select Selection.copy .body= "good evening"
@greggowaffles
@greggowaffles 4 года назад
hey, you can have a text variable called greeting and have .body = greeting. in your if statement, make greeting = "good morning" or "good evening", so that when you assign it to .body, it will change
@martinkeane8293
@martinkeane8293 2 года назад
This is great thank you! I have a question, I would like to do this with if and statements. I.e if column A has a certain value in column B then include in the email.
@jesuseduardobittersuarez7517
@jesuseduardobittersuarez7517 3 года назад
what if i have two mire tables each in a diferent sheet but all three tables need to go on the same email? HELP CRYING
@greggowaffles
@greggowaffles 3 года назад
dont cry!! check this video out. hope it helps! ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9q8gZF0UOt8.html
@NickFilipovic
@NickFilipovic Год назад
you're a pretty dope dude
@greggowaffles
@greggowaffles Год назад
I appreciate that!
@sanketnarkhede2585
@sanketnarkhede2585 3 года назад
Hey , If I want to select particular columns to attach..Where should I have to change..could you please guide me
@greggowaffles
@greggowaffles 3 года назад
hi! you can select individual columns by hiding the columns you dont want, and then copying and pasting the visible cells to another sheet, and then set pop = to the that range
@androjxe6298
@androjxe6298 2 года назад
thank you for this tutorial.. I really appreciate it
@coeannauniversity9489
@coeannauniversity9489 4 года назад
msg.body = sh.Range("D" & i).Value how to give range in this .. range with variable
@greggowaffles
@greggowaffles 4 года назад
Range("D"& i).Value is the same as Range(Cells(i,4))
@chintu6923
@chintu6923 2 года назад
hey Gregg,your videos have been very helpful to me They are simple and very easy to understand for a beginner like me Thank You so much
@greggowaffles
@greggowaffles 2 года назад
No problem! So glad to hear that!!
@borsnak
@borsnak 3 года назад
Hi, I get project not found error. It highlights me the Environ$("temp"). Do you have any suggestion? Thanks
@greggowaffles
@greggowaffles 3 года назад
I looked online and it says this happens when you've "created a function or other routine called format. Put the cursor on the word Format and press Shift+F2". Hope that helps. Its from this site stackoverflow.com/questions/43096639/rangetohtml-no-longer-working
@viswanathmanikandan3736
@viswanathmanikandan3736 2 года назад
Thank you Greg, This will just save my day :) Keep up the good work :)
@greggowaffles
@greggowaffles 2 года назад
so glad to hear that! thank you so much!!
@shimaamohamed5746
@shimaamohamed5746 3 года назад
If you please, this content didn't work for me and I don't know why it might help
@greggowaffles
@greggowaffles 3 года назад
What's your code look like?
@Bombfun
@Bombfun Год назад
Thanks! It works! U solved my problem!
@greggowaffles
@greggowaffles Год назад
So glad to hear that!!
@srinivassri7067
@srinivassri7067 4 года назад
Hi, I have data in 2 sheets (names as Day 1 & Day 2) in tabular format. day 1 sheet has certain details of X & Y person in 2 rows. day 2 sheet has other data of person X, Y, Z. If i want to send X person details from both sheets via email. How can this be done. In same way i want to send mails for each person listed in both the sheets with their data.
@greggowaffles
@greggowaffles 4 года назад
hi. hope this helps: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9q8gZF0UOt8.html
@joelabacherli1310
@joelabacherli1310 6 месяцев назад
This is what RU-vid is made for. Casual but extremely informative. Just like a buddy sitting with you. Your vids rock, man. Much appreciated.
@greggowaffles
@greggowaffles 6 месяцев назад
Appreciate the feedback. Thank you!
@vanessacabral6163
@vanessacabral6163 4 месяца назад
@greggowaffles can you post the function for this? Looks like he removed all of his code from his website back in October
@philseven1351
@philseven1351 Год назад
Thanks! This worked for me, but how can I turn this into a command button that I can press on the excel sheet that will initiate the email instead of pressing green arrow in the VBA menu?
@EdgarPachecoSolano
@EdgarPachecoSolano Год назад
You only need to put a figure on the excel and rigth click and "assign macro" That is all
@philseven1351
@philseven1351 Год назад
@@EdgarPachecoSolano Thanks!
@fish_bike
@fish_bike Год назад
Greg, your videos are super helpful, and I definitely appreciate them! I am having an issue with the not all the cells ending up in the email. Is there a way to set a defined area, like from A1 to F20?
@tomassantos6731
@tomassantos6731 Год назад
i, you can change: Set Pop = Sheets("Planilha padrao").Range(Cells(1, 1), Cells(20, 6))
@laedays
@laedays 3 года назад
Hi! Can you help me fix my error? I am using Office 365 and tried to replicate the formula you created. I am having Compile Error: Sub or Function not defined and it highlighted RangetoHTML(pop) in the line of str1 & RangetoHTML(pop) & str 2. How do i make it work?
@laedays
@laedays 3 года назад
@greggowaffles
@greggowaffles
@greggowaffles 3 года назад
Did you copy and paste the RangetoHTML function in another module? There's a link in the description for the code
@laedays
@laedays 3 года назад
@@greggowaffles CAn i have your email add and send you the file i am working with
@honeydheeflores6812
@honeydheeflores6812 6 месяцев назад
You have made my work so easy! Thank you so much for sharing this video with your awesome knowledge. God bless you!
@greggowaffles
@greggowaffles 6 месяцев назад
Happy to help!!
@brittaniguidry6061
@brittaniguidry6061 3 месяца назад
@honeydeeflores6812 Do you have the code you can share with me?
@dannydanny00
@dannydanny00 Год назад
This was very helpful Greg ... thanks a lot !!
@greggowaffles
@greggowaffles Год назад
No prob! So glad to hear that!! Thanks for watching!
@mehulgorasia
@mehulgorasia 3 года назад
Hi Greg, Thank you for the great video. When I run this code, I receive "Save" prompts for the Temp Workbook. I've tried the usual Application.Display Alerts = False and then after Application.Display Alerts = True method. However, I'm still having the same issue of a new sheet each time opening up. Any idea why this could be happening or the solution to this? Thank you, I await your reply.
@greggowaffles
@greggowaffles 3 года назад
thanks! are you using mac or pc?
@mehulgorasia
@mehulgorasia 3 года назад
Hi Greg, thanks for the reply. PC
@greggowaffles
@greggowaffles 3 года назад
@@mehulgorasia try removing the Application.Display Alerts = True, and only use Application.Display Alerts = False at the beginning of your code. let me know if that does anything
@mehulgorasia
@mehulgorasia 3 года назад
@@greggowaffles tried that didn’t work either. For only one of my colleagues, the exact same code works on their excel (with no save prompts) and straight produces the email. However, our excel settings seem the same. Any thoughts?
@greggowaffles
@greggowaffles 3 года назад
If you have anything that starts with "on error..." in your code, comment that out and see if the code breaks. Thats probably where the answer is
@chaimaebouhdid9007
@chaimaebouhdid9007 2 года назад
Thank you so much! thanks to your video I will be saving a lot of my time
@greggowaffles
@greggowaffles 2 года назад
So glad to hear that! Thanks for watching!!
@kunalvora
@kunalvora Год назад
Just couldn't figure out how to paste multiple tables from excel to email and just came across this video multi table pasting works now, thanks a lot!!!!!!!!!!!!
@greggowaffles
@greggowaffles Год назад
So glad to hear that!!
@kunalvora
@kunalvora Год назад
Do you know why the numbers in the tables pasted in outlook don't have any space between them and the border of the table? If you check your own video the space between the numbers and the border of the table in Excel is much higher than that in Outlook
@arniepa
@arniepa 3 года назад
Firstly massive thank you for sharing the code but could you add the code into the description text to save me having to pause, type, pause, type,delete retype ? Saves my poor old eyes :( - not sure if I have miss typed something I must be doing something wrong as I am seeing an error in the :- .HTMLBody = str1 & RangetoHTML(pop) & str2 & .HTMLBody the debug stops on the "RangetoHTML(pop)" text A error message shows "compile error expected variable or procedure not module
@greggowaffles
@greggowaffles 3 года назад
No prob! I get an error whenever I try adding the code to the description. Did you add the RangetoHTMl function to module 2 from the Ron de Bruin site?
@arniepa
@arniepa 3 года назад
@@greggowaffles Hi - yes I did and at the weekend no joy but come back to look today and its worked ! Just need it to select the correct cells but progress all the same thank you for sharing the video
@greggowaffles
@greggowaffles 3 года назад
@@arniepa so glad to hear that!!!
@arslanuddin8928
@arslanuddin8928 4 года назад
Good effort, kindly make the coding txt words bigger as i am unable to see it clearly.
@greggowaffles
@greggowaffles 4 года назад
Sorry for that
@nickobalboa
@nickobalboa 3 года назад
Where did you get the RangetoHTML(pop)?
@greggowaffles
@greggowaffles 3 года назад
Check out the link in the description. The code for the RangetoHTML function is there
@arulmozhikarunanidhi1948
@arulmozhikarunanidhi1948 3 года назад
pls help me i want tis for all my excel i.e without specifying the doc name is it possible
@greggowaffles
@greggowaffles 3 года назад
hope this helps: www.pryor.com/blog/save-your-excel-macro-for-use-in-all-workbooks/
@alexanderv2007
@alexanderv2007 2 года назад
Great explanation. Greetings from Russia ✌
@greggowaffles
@greggowaffles 2 года назад
Thank you for watching!!! ✌️
@shiyong6444
@shiyong6444 4 года назад
Can RangeToHTML function, don't copy and paste the hidden column. This is because I noticed when I run the function it will also send the hidden column in the email body Thank you.
@greggowaffles
@greggowaffles 4 года назад
If you got to the code in the RangetoHTML function and go down to where it says "rng.copy" and change it to "rng.SpecialCells(xlCellTypeVisible).Copy", that should get rid of the hidden column. Hope that helps!
@arulmozhikarunanidhi1948
@arulmozhikarunanidhi1948 3 года назад
@@greggowaffles its not working for me pls help me out
@zahidimranx
@zahidimranx 2 года назад
Superrrrrbbbbbbbbbbbbbbbbbbbbbb
@greggowaffles
@greggowaffles 2 года назад
Thanks!
@zahidimranx
@zahidimranx 2 года назад
@@greggowaffles Sir, can you please tell me that how we can attach chart 📊 in email body with same way by embed in html.?
@miggi4665
@miggi4665 3 года назад
It's sad to know this doesn't work in a Macbook Air excel :(
@greggowaffles
@greggowaffles 3 года назад
yeah, i use bootcamp to switch over to Windows whenever i want to use excel on my mac
@howardfoo2370
@howardfoo2370 4 года назад
Hi, just wondering if in one of the strings that i use for the email body, is a value of a cell; am I able to have the value with the format in the email body as well? Such as the underline/bold etc.
@greggowaffles
@greggowaffles 4 года назад
Hi. I know that can use and before the value and and after the value in your code, in order to underline/bold that value in the email body. I've never been able to get underline/bold formatting directly from the cell, unless I put the HTML code directly in the cell
@sams9329
@sams9329 4 года назад
Can we send all employee performance data of the email body in the form of a picture with its name and performance number
@greggowaffles
@greggowaffles 4 года назад
Most definitely
@francoispo1481
@francoispo1481 Год назад
amazing
@jayeshs6618
@jayeshs6618 2 года назад
Thank you so much... Found exactly as I needed 👍🏻
@greggowaffles
@greggowaffles 2 года назад
Glad to hear that! Thank you for watching!!
@t00by00zer
@t00by00zer 3 года назад
Very cool video. My question would be how to have the email setup section To: Cc: Bcc: Subject: Instead of simple strings in quotes, how do you reference cells with the data? For example a cell with a string of email addresses separated by semicolon?
@greggowaffles
@greggowaffles 3 года назад
Thanks! Say the cell you want to reference is on a sheet named "Contacts" and the name is on cell B4. You would do .to = ThisWorkbook.Sheets("Contacts").Cells(4,2).Text. I go over it in more detail in this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-dMumM47cm2s.html
@t00by00zer
@t00by00zer 3 года назад
@@greggowaffles Thanks a bunch. I'll tune in.
@charvezard3289
@charvezard3289 9 месяцев назад
This channel is wildly helpful. Thank you.
@greggowaffles
@greggowaffles 9 месяцев назад
So happy to hear that! Appreciate the feedback!!
@danielasevdin7976
@danielasevdin7976 4 года назад
Hi Greg, great video! I have a question.. i have to send out 50+ emails and I need to include a table in that email but the data in the table has to be filtered with data that can only be shared with that person. How can I adjust this code to do that?
@greggowaffles
@greggowaffles 4 года назад
thanks! you can combine code from these these videos to make that work: (1) send bulk emails: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-7Chuqz5M65U.html (2) autofilter based on cell value and copy to new sheet: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-dEAozqfZFHE.html you can have your macro go through each line in your list (1) and reference a cell used to filter and copy that data to a new sheet (2) to be used as a table in (1); repeating the process as you move down the list of 50+ entries
@bankers55
@bankers55 3 года назад
How do i add multiple sheets not just one and more emails addresses
@greggowaffles
@greggowaffles 3 года назад
you can put a semi colons in between email addresses and this video goes over how to use multiple ranges: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9q8gZF0UOt8.html
@collegeboy909
@collegeboy909 4 года назад
Do i have to start at cell A1 ? I am trying to go from cell I16 to K17
@greggowaffles
@greggowaffles 4 года назад
nope. you can start anywhere. i go over it in this video for multiple ranges: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9q8gZF0UOt8.html
Далее
小路飞嫁祸姐姐搞破坏 #路飞#海贼王
00:45
Convert Range To HTML Table Excel VBA Macro
8:10
Просмотров 2,9 тыс.
VBA: Send Email With Outlook Mail body Snapshot
6:59
Excel VBA Macro: Send Email (with Attachment)
8:55
Просмотров 59 тыс.
How To Copy An Excel Range To Outlook Using VBA
18:29