none
How to get the image resolution using excel VBA RRS feed

  • General discussion

  • Hi All

    i want to retrive the image height,width,horizantal and vertical resolution using excel VBA.

    I tried this code, but i'm getting only height and width. Please assist on this.

    Sub imageResolution()

    Dim P As StdPicture
    Dim Path As String
    Path = "C:\Users\sample.gif"
    Set P = LoadPicture(Path)

    MsgBox P.Height & "x" & P.Width

    End Sub

    Regards

    Prasad Telu

    Thursday, September 5, 2013 1:26 PM

All replies

  • Check below link..

    http://msdn.microsoft.com/en-us/library/windows/desktop/bb787870(v=vs.85).aspx

    In your VBA project add reference to Microsoft Shell Controls and Automation.


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    Thursday, September 5, 2013 3:26 PM
    Answerer
  • Sub ShowResolution()
    
        Dim i As Long
        Dim SH As Object
        Dim fImFile As Object
        Dim FOL As Object
        
        Set SH = CreateObject("Shell.Application")
        
        With Application.FileDialog(msoFileDialogFolderPicker)
            .Title = "Select the Folder..."
            If .Show Then
                Set FOL = SH.Namespace(.SelectedItems(1))
                For Each fImFile In FOL.Items
                        MsgBox fImFile.Name & crlf _
                            & FOL.GetDetailsOf(fImFile, 31)
                Next fImFile
            End If
        End With
        
    End Sub


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    Friday, September 6, 2013 2:49 PM
    Answerer