gordonwwaugh
asked on
Get resolution of graphic file using VBA
I want VBA (Visual Basic for applications) within MS Access to get the resolution of a graphic file (i.e., png, gif, bmp, jpeg). By the way, I need the width and height of the graphic because I am generating html code that rescales the graphic to the appropriate size.
Is there a VBA function or windows call that returns this information?
Is there a VBA function or windows call that returns this information?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The expert's solution has one error.I wouldn't assert that my original code post had errors, since it worked for me. Like you, I didn't know that the Namespace() parameter had to be a Variant data type. The string literal I used was being automatically cast by the compiler/interpreter. When working to quickly answer EE questions, I'm often in the Immediate Window where all dynamic variables are variant.
ASKER
The expert's solution has one error. My solution fixes the error and adds additional supporting code such as variable declarations.
ASKER
However, something weird is happening. It fails if I replace the "c:\users\mark\downloads" with a string variable name. For example, this doesn't work:
strFoldername = "c:\users\mark\downloads"
set objFolder = objShell.NameSpace(strFold
When I use this code, I get the following error on the "set objFile = ..." line: "Object variable not set." I have verified that the strFoldername value is correct.
Any ideas? Surely I am allowed to use a variable name in the "set objFolder" statement rather than a quoted string.