I’m glad you’re doing this series again. Andrew, you’re a great teacher and I learned so much from you. I have donated in the past as a thank you for your time. Thrilled to see another video from you!!
@@WiseOwlTutorials One year ago; i have no idea about VBA; your video is the best ; i keep watching your list video everyday ; i hope you will continue series VBA ; honesly
@@WiseOwlTutorials I have learned from your lessons. And I had adapted it to extract data from SAP when I worked at CCBVL. I even created an interface to do inventory count, but the idea is death for some reasons which relate to my college. I had done that and all thanks to you! God bless you sir! ^^!
Hi!! It's a great video!! I have learnt alot from your videos.. i have a doubt..can we add multiple pictures? I have changed the range but still it shows error! Could you please suggest me an idea of how to add two or more pictures!
I need to open outlook message saved as .msg and replace all pictures in body with other images, but keep position and size. I've tried to Attachments.Add method with hidden position which is fine but stuck how to replace old pictures. In simpler case assume there's only one picture.
Hi thanks for this great video. Help me a lot. One question, how should I code the Excel VB to insert the text over the image in the email? (considering that I'd like to use the image as a watermark).
Sure! You can add a hyperlink like so: Set doc = mi.GetInspector.WordEditor Set shp = doc.Range(0, 0).InlineShapes.AddPicture("C:\Wise Owl\Images\Wise Owl.jpg") doc.Hyperlinks.Add shp, "https:\\www.wiseowl.co.uk" I hope that helps!
I have worksheet with an image and want to send worksheet as attachment and include images within worksheet. when I do this it does not include image. How do I get the image to stay in the attachment? Sending vba email with outlook
Hi Andrew, the code Error 287: Application-defined or object-defined error on doc.Inspector. I have the word reference checked. Can you help here please ?
Hi Andrew, Thank you so much for this knowledgeable video tutorial as always, I have couple of requests to you if you have time in near future, can you make tutorials about the points mentioned below. Point 1:- I have data in excel from range A2:C10 as (Column “A” :- subject of outlook mail), (Column “B” :- time of the mail), (Column “C” :- Sender of the mail) etc. Now what I want that when I click on any cell between A2:C10, the mail body of selected mail should show in somewhere in excel as formatted as outlook mail body, that means I want to see the mail body of the selected mail in the excel, no need to go outlook to see the output. I searched this on google, however I did not find any answer, kindly request to you please please please post the video tutorial about above problem. Point 2:- I have a situation where I want to save the attachments from the outlook inbox, where a mail has a attachments, the attachments can be anything like word file, excel file, image, text file etc., I found some code from net to resolve this problem, however the problem is that it is also considering those mails that has not any attachments but the embedded pictures pasted in the mail body. I want to save those attachments that are attached with the mail not images pasted in the mail body. I hope I described my problem clearly. Finally thank you so much for these tutorials, I learned a lot means a lot from watching your video tutorials. Thanks Kashif
Hi Andrew, Thank you so much for reply, I will try the code you post in the reply and let you about the outcome, as always thank you so much for your precious time. Thanks Kashif
Hello sir, When I use one code to past the jpg picture as singture and code work fine but when I received email and I try to open that email I get a pop msg Connecting the server in Outlook plz help use to fix the issue Thanks in Advance
Hi Shaielsh, I can't seem to replicate the problem you're describing. The code shown in the video works correctly and I can open the email on multiple devices and see the image that has been sent. I'm sorry but I don't know why you're experiencing this problem.
Hi Akash, images in Excel are inserted into a worksheet rather than into a cell. An image belongs to the Shapes collection of the sheet and yes, you can capture a reference to it in a variable. If you want to copy and paste a picture from Excel into Outlook, here's the basic code: Sub CopyPictureIntoEmail() Dim olApp As Outlook.Application Dim olEmail As Outlook.MailItem Dim wdDoc As Word.Document Dim sh As Shape Set olApp = New Outlook.Application Set olEmail = olApp.CreateItem(olMailItem) olEmail.Display Set wdDoc = olEmail.GetInspector.WordEditor Set sh = Worksheets("Sheet1").Shapes(1) sh.Copy wdDoc.Range(1, 1).Paste End Sub I hope that helps!
Hi! There's a range of actions the macro recorder won't record (sorry, I don't know the reasons). What is it that you're trying to save as a picture? If it's a chart you can use the Export method docs.microsoft.com/en-us/office/vba/api/excel.chart.export I hope it helps!
@@TheSardOz Yeah, there's a bit of a hacky way around it which involves creating an empty chart, using the CopyPicture method on your group object and then pasting the picture into the the empty chart and then using the Export method on the chart to save it as a picture(!). I'll try to get a short answer video done but here's the basic code Sub SaveChartGroupAsPicture() Dim grp As Shape Dim co As ChartObject
Set grp = Sheet1.Shapes("MyChartGroup") grp.CopyPicture
Set co = Sheet1.ChartObjects.Add( _ Left:=grp.Left, _ Top:=grp.Top, _ Width:=grp.Width, _ Height:=grp.Height)
@@WiseOwlTutorials yep, I had to do it that way but I might have few extra steps... I would love to see the video and hear the comments..... thank you Mr🦉
Following comment is mainly for information purposes: There might be cases that even though all references are enabled, it seems that in Win 10, office 365 has a "run-time error 287: Application-defined or object-defined error" in relation to reaching .WordEditor Hope Microsoft will fix this at some point as some scripts became unusable :( Am still able to run the script on a Win 7 machine.
Copied your code and ran it 3 times. It worked. After that it stopped working. The issue happens to be with the mi.getinspector.wordeditor line which returns nothing. I get error 91 'object variable or with block variable not set' on the line: set shp = doc.range(0, 0)....etc. Cannot understand why code would suddenly stop working! Any ideas would be appreciated. I've spent 3 hours googling it. Nothing helpful.
@@WiseOwlTutorials Thank you for coming back to me. On the day I wrote to you I even rebooted and that didn't work either. So I gave up. The next day it worked. But I got a different error on one occasion. I've learned that if outlook is open already it tends to work more reliably. With outlook closed I never know what I will get!
Please, don't stop launching new videos. They are the best of TH-cam by far.
I’m glad you’re doing this series again. Andrew, you’re a great teacher and I learned so much from you. I have donated in the past as a thank you for your time. Thrilled to see another video from you!!
There is no one like you Andrew when it comes to teaching tutorials, you are so gifted and we are so fortunate. Thanks for a nother greate video.
I like the way you teach!!! Please keep making videos!
Greetings !!! The best teacher there is!!!
Nice to see you again @andrew Gould
i really loved the way you explained this. I learned this in one shot. Thanks a lot
Makes me delighted that you r back Andrew 😂😂😂😂
@@WiseOwlTutorials me and my colleagues are biggest fan of your teaching, keep up the good good work
Cristal clear as usual. Thanks Andrew.
Nice to hear your lesson again ^^!
Thanks Andrew and again, Welcome back.
Thank you for the nice and informative video. Looking forward for your next video
This really helped!!
This solved a crucial deliverable..Really happy about the solution :)
Hello!
In the portion of the video where you insert text before the image, how would you do this with HTML tags in the text?
Thanks!
Wow; i have waited 1 year since your last video; sr for my bad English
@@WiseOwlTutorials One year ago; i have no idea about VBA; your video is the best ; i keep watching your list video everyday ; i hope you will continue series VBA ; honesly
@@WiseOwlTutorials I have learned from your lessons. And I had adapted it to extract data from SAP when I worked at CCBVL. I even created an interface to do inventory count, but the idea is death for some reasons which relate to my college.
I had done that and all thanks to you!
God bless you sir!
^^!
@@WiseOwlTutorials i am glad to hear that; thank you so much :)
Thanks Andrew, I love it.
Thank you very much for this helpful video
Awesome!! Speechless. Thank you
Thank you very much, it was very useful...
Hi Andrew. Nice ones. I thought you have discontinued the vba series.
That was amazing!!... Can we apply the same approach with vbScript...Could you give some hints?
Very Nice!
Is there a way not to have to keep selecting the outlook and word object librarys'?
Merci beaucoup
Great vídeo.
One question can I use both mail.body and wordeditor in the same mail object??
Thank you very much
Hi!! It's a great video!! I have learnt alot from your videos.. i have a doubt..can we add multiple pictures? I have changed the range but still it shows error! Could you please suggest me an idea of how to add two or more pictures!
I need to open outlook message saved as .msg and replace all pictures in body with other images, but keep position and size. I've tried to Attachments.Add method with hidden position which is fine but stuck how to replace old pictures. In simpler case assume there's only one picture.
Thank for this video...
Hi thanks for this great video. Help me a lot. One question, how should I code the Excel VB to insert the text over the image in the email? (considering that I'd like to use the image as a watermark).
Hi its a great video could you please tell as how to add an internet address as a hypelink to that picture?
Sure! You can add a hyperlink like so:
Set doc = mi.GetInspector.WordEditor
Set shp = doc.Range(0, 0).InlineShapes.AddPicture("C:\Wise Owl\Images\Wise Owl.jpg")
doc.Hyperlinks.Add shp, "https:\\www.wiseowl.co.uk"
I hope that helps!
Super thank you soo much
You're very welcome!
hi Andrew i have done this but i can see half the image. when i manually do WRAP SQUARE then only i can see full image. is there any way through VBA
What if image to be picked up from another sheet. Which function to use
Plz make a video on Birthday mail
I have worksheet with an image and want to send worksheet as attachment and include images within worksheet. when I do this it does not include image. How do I get the image to stay in the attachment? Sending vba email with outlook
Hi Andrew, the code Error 287: Application-defined or object-defined error on doc.Inspector. I have the word reference checked. Can you help here please ?
I get the same error :( Do you find any solution ?
I would like to add Thank You at the last of email after that picture.. What I have to write in a code for that or how to do that?
hey, if you find the answer could you share it with me?
Hello. Just wondering if you did manage to find a solution to this? I too would like to do this. Thanks!
How do i center align it
Hi Andrew,
Thank you so much for this knowledgeable video tutorial as always, I have couple of requests to you if you have time in near future, can you make tutorials about the points mentioned below.
Point 1:-
I have data in excel from range A2:C10 as (Column “A” :- subject of outlook mail), (Column “B” :- time of the mail), (Column “C” :- Sender of the mail) etc.
Now what I want that when I click on any cell between A2:C10, the mail body of selected mail should show in somewhere in excel as formatted as outlook mail body, that means I want to see the mail body of the selected mail in the excel, no need to go outlook to see the output. I searched this on google, however I did not find any answer, kindly request to you please please please post the video tutorial about above problem.
Point 2:-
I have a situation where I want to save the attachments from the outlook inbox, where a mail has a attachments, the attachments can be anything like word file, excel file, image, text file etc.,
I found some code from net to resolve this problem, however the problem is that it is also considering those mails that has not any attachments but the embedded pictures pasted in the mail body.
I want to save those attachments that are attached with the mail not images pasted in the mail body.
I hope I described my problem clearly.
Finally thank you so much for these tutorials, I learned a lot means a lot from watching your video tutorials.
Thanks
Kashif
Hi Andrew, Thank you so much for reply, I will try the code you post in the reply and let you about the outcome, as always thank you so much for your precious time.
Thanks
Kashif
Hello sir,
When I use one code to past the jpg picture as singture and code work fine but when I received email and I try to open that email I get a pop msg Connecting the server in Outlook
plz help use to fix the issue Thanks in Advance
Hi
Shaielsh, I can't seem to replicate the problem you're describing. The code shown in the video works correctly and I can open the email on multiple devices and see the image that has been sent. I'm sorry but I don't know why you're experiencing this problem.
Can an image be extracted from an Cell instead of drive. Any way to use the image like variable?
Hi Akash, images in Excel are inserted into a worksheet rather than into a cell. An image belongs to the Shapes collection of the sheet and yes, you can capture a reference to it in a variable. If you want to copy and paste a picture from Excel into Outlook, here's the basic code:
Sub CopyPictureIntoEmail()
Dim olApp As Outlook.Application
Dim olEmail As Outlook.MailItem
Dim wdDoc As Word.Document
Dim sh As Shape
Set olApp = New Outlook.Application
Set olEmail = olApp.CreateItem(olMailItem)
olEmail.Display
Set wdDoc = olEmail.GetInspector.WordEditor
Set sh = Worksheets("Sheet1").Shapes(1)
sh.Copy
wdDoc.Range(1, 1).Paste
End Sub
I hope that helps!
@@WiseOwlTutorials Thanks a lot Sir for your precious time. Appreciate the way you are helping the world to learn VBA. Respect from India 🙏🙏
You're very welcome Akash!
Why the record macro won’t record the steps when I use save as picture?
Hi! There's a range of actions the macro recorder won't record (sorry, I don't know the reasons). What is it that you're trying to save as a picture? If it's a chart you can use the Export method docs.microsoft.com/en-us/office/vba/api/excel.chart.export
I hope it helps!
@@WiseOwlTutorials Im trying to save 3 chart object group as one shape into a folder with VBA, but I can’t manage export the shape directly …
@@TheSardOz Yeah, there's a bit of a hacky way around it which involves creating an empty chart, using the CopyPicture method on your group object and then pasting the picture into the the empty chart and then using the Export method on the chart to save it as a picture(!).
I'll try to get a short answer video done but here's the basic code
Sub SaveChartGroupAsPicture()
Dim grp As Shape
Dim co As ChartObject
Set grp = Sheet1.Shapes("MyChartGroup")
grp.CopyPicture
Set co = Sheet1.ChartObjects.Add( _
Left:=grp.Left, _
Top:=grp.Top, _
Width:=grp.Width, _
Height:=grp.Height)
co.Select
co.Chart.Paste
co.Chart.Export _
Filename:=Environ("UserProfile") & "\Desktop\ChartPic.jpg", _
FilterName:="JPG"
co.Delete
End Sub
@@WiseOwlTutorials yep, I had to do it that way but I might have few extra steps... I would love to see the video and hear the comments..... thank you Mr🦉
@@TheSardOz Glad you found the solution!
Following comment is mainly for information purposes:
There might be cases that even though all references are enabled, it seems that in Win 10, office 365 has a "run-time error 287: Application-defined or object-defined error" in relation to reaching .WordEditor
Hope Microsoft will fix this at some point as some scripts became unusable :(
Am still able to run the script on a Win 7 machine.
Thank you for sharing the information Stefan!
Copied your code and ran it 3 times. It worked. After that it stopped working. The issue happens to be with the mi.getinspector.wordeditor line which returns nothing. I get error 91 'object variable or with block variable not set' on the line: set shp = doc.range(0, 0)....etc. Cannot understand why code would suddenly stop working! Any ideas would be appreciated. I've spent 3 hours googling it. Nothing helpful.
Hi Micci! I'm sorry I don't have any idea why it would suddenly stop working, are you still experiencing the same issue?
@@WiseOwlTutorials Thank you for coming back to me. On the day I wrote to you I even rebooted and that didn't work either. So I gave up. The next day it worked. But I got a different error on one occasion. I've learned that if outlook is open already it tends to work more reliably. With outlook closed I never know what I will get!
@@micci2395 Interesting, thanks for reporting your findings!