In the text document in which I created the VBA code, I need to be able to display images in a custom form, as well as resize the custom form to fit any image they render.
I was very confused when I tried to do something similar in the Immediate Box (the image file is actually only 675 pixels wide):
? LoadPicture("C:\Users\arose\Desktop\Security Control Doc\Images\AC1.bmp").Width 17859
In the end, I found that this is due to VBA using some units besides pixels. Twips, or something like that. But I really need to have image sizes in pixels, so I retired, found roughly what the conversion factor is, and I use this:
Function TwipsToPixels(Twips As Long) As Long TwipsToPixels = Twips / 25.477 End Function
It helped, but it is not particularly accurate. So my question is: does anyone have a more elegant and accurate way to get image sizes in VBA?
source share