Myke Myers
mmm at tbig.com
Mon Jun 29 09:24:19 CDT 2009
'--------------------------------------------------------------------------- ------------ ' Procedure : fGetImageDimensions ' DateTime : 6/27/2009 15:55 ' Author : mmmyers ' Purpose : uses image pathfilename to get width x height in pixels '--------------------------------------------------------------------------- ------------ ' Public Function fGetImageDimensions(strImagePathFilename As String) As String Dim objImage As Object Dim fs As Object Dim iWidth As Integer Dim iHeight As Integer On Error GoTo fGetImageDimensions_Error 'modImages.fGetImageDimensions Set fs = CreateObject("Scripting.FileSystemObject") If Not fs.FileExists(strImagePathFilename) Then Exit Function Set objImage = LoadPicture(strImagePathFilename) iWidth = Round(objImage.Width / 26.4583) iHeight = Round(objImage.Height / 26.4583) fGetImageDimensions = iWidth & "x" & iHeight ExitHere: Set objImage = Nothing Set fs = Nothing Exit Function fGetImageDimensions_Error: Select Case Err.Number Case Else MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical, "modImages.fGetImageDimensions" End Select Resume ExitHere 'When the messagebox for the error appears, press Ctrl-Break to debug Resume 'Click on this line and press Ctrl-F9 for debugging ' End Error handling block. tbig v1.1 End Function