Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default get a picture width and height without inserting the picture

I am using office 2003 and writing a VBA. I want to get a picture width and
height without inserting the picture to the worksheet. Is there any solution?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default get a picture width and height without inserting the picture

Hi Dorothy,

The following routine requires a reference to the Microsoft Scripting
Runtime Library ( Tools | References | Navigate to and Check the library)


Sub Tester1()

strFolder = "C:\Documents and Settings\My Pictures"
strFile = "Test.gif"

Set objShellApp = CreateObject("Shell.Application")
Set objFolder = objShellApp.NameSpace(strFolder)
Set objFolderItem = objFolder.ParseName(strFile)


Dim arrHeaders(39)
For i = 0 To UBound(arrHeaders)
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next


For i = 0 To UBound(arrHeaders)
MsgBox i & vbTab & arrHeaders(i) _
& ": " & objFolder.GetDetailsOf(objFolderItem, i)
Next

End Sub


The above routine returns many more attributes than you have asked for. You
could restrict it to attributes of immediate interest, e.g.:

Sub Tester2()
strFolder = "C:\Documents and Settings\My Pictures"
strFile = "Test.gif"

Set objShellApp = CreateObject("Shell.Application")
Set objFolder = objShellApp.NameSpace(strFolder)
Set objFolderItem = objFolder.ParseName(strFile)


strSize = objFolder.GetDetailsOf(objFolderItem, 1)
MsgBox "Size: " & strSize


strDatePT = objFolder.GetDetailsOf(objFolderItem, 25)
MsgBox "Date Picture Taken: " & strDatePT

End Sub

---
Regards,
Norman



"Dorothy" wrote in message
...
I am using office 2003 and writing a VBA. I want to get a picture width and
height without inserting the picture to the worksheet. Is there any
solution?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting picture into spreadsheet lendab Excel Discussion (Misc queries) 2 February 4th 10 07:09 PM
Inserting a Picture using Cell as picture name. the-jackal Links and Linking in Excel 12 November 10th 08 09:21 AM
Inserting a picture Boban76 Excel Discussion (Misc queries) 2 July 19th 06 02:56 PM
Inserting a picture comotoman Excel Discussion (Misc queries) 3 October 16th 05 02:02 PM
Inserting Picture LMB New Users to Excel 1 October 2nd 05 11:02 PM


All times are GMT +1. The time now is 11:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"