Hi expert,
For other image format, i can use below to get the Height and Width
Set p = LoadPicture(imagefile)
PicHt = p.Height
PicWid = p.Width
But loadpicture not support PNG file format, is that any other method to do so?
Hi expert,
For other image format, i can use below to get the Height and Width
Set p = LoadPicture(imagefile)
PicHt = p.Height
PicWid = p.Width
But loadpicture not support PNG file format, is that any other method to do so?
Hi Chocobo,
The following code works for me to insert a .PNG file into a spreadsheet:
Lewis![]()
Sub ImportPngFile() Dim vntFilename As Variant Dim p As Object vntFilename = Application.GetOpenFilename("Images (*.png),*.png") If vntFilename = "False" Then Exit Sub Range("B11").Select 'Top and Left at Cell 'B11' Top Left Corner Set p = ActiveSheet.Pictures.Insert(vntFilename) Debug.Print p.Top Debug.Print p.Left Debug.Print p.Height Debug.Print p.Width End Sub
Last edited by LJMetzger; 08-31-2015 at 10:02 AM.
Hi Lewis,
Thanks for help, actually I tried to use Picture.Insert before, but seems this is only insert the link to excel but not the actual image....
After inserting, I changed the name of the .png file, closed Excel, and opened the file again. The image seems to be a permanent part of my Excel file using Excel 2003.
When I remove the image from the Excel file, the Excel file size decreases by the size of the .png file.
Lewis
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks