+ Reply to Thread
Results 1 to 2 of 2

get a picture width and height without inserting the picture

  1. #1
    Dorothy
    Guest

    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. #2
    Norman Jones
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    >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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1