问题
I have an image object on a userform. I want to save the picture from that image object into a file. I see many examples of how to load a picture into an image object, but none the other way around.
I tried stdole.SavePicture obj.Picture, strFilePath
, but that only works for button objects.
回答1:
First create a Chart. Second place the picture in the Chart. Finally export the Chart.
EDIT#1
For sample code see:
Save Picture with VBA
回答2:
I don't know if this will help, but I tried casting the Picture object to an IPictureDisp object to pass it to the stdoleSavePicture function, and it worked for me.
Here's the code:
Dim pic As IPictureDisp
Set pic = myForm.Image1.Picture
stdole.SavePicture pic, "C:\myfile.jpg"
来源:https://stackoverflow.com/questions/31922261/word-vba-how-to-save-picture-from-image-object-to-file