List properties of images in workbook

mwperkins

Board Regular
Joined
Oct 29, 2002
Messages
153
Hi,
Does anyone have some code that can loop through each sheet in the activeworkbook and list all shapes/images and their dimensions / properties?

I am most interested in the resolution of the images, but it would be useful to know other info too.


Can anyone help?

thanks,
Mark
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
4,664
Office Version
365
Platform
Windows
Here is a starting point for you
Put this code in a new module and run LoopShapes

Code:
Option Explicit
Private wb As Workbook, ws As Worksheet, sh As Long, sName As String, cel As Range
Private Shp As Shape, N As String, W As Double, H As Double, TLC As String, BRC As String, T As Integer

Sub LoopShapes()
    Call Environment
    
    For sh = 1 To wb.Worksheets.Count
        For Each Shp In wb.Worksheets(sh).Shapes
            sName = wb.Worksheets(sh).Name
            Call GetCommonDetails
            cel.End(xlUp).Offset(1).Resize(, 7) = Array(sName, N, H, W, TLC, BRC, T)
        Next Shp
    Next sh
End Sub

Private Sub Environment()
    Set wb = ThisWorkbook
    Set ws = wb.Worksheets.Add
    Set cel = ws.Cells(Rows.Count, "A")
    With ws.Range("A1").Resize(, 7)
        .Value = Split("Sheet Name Height Width TopLeft BottomRight ShapeType")
        .Font.Bold = True
        .ColumnWidth = 20
    End With
End Sub

Private Sub GetCommonDetails()
    With Shp
        N = .Name
        H = .Height
        W = .Width
        TLC = .TopLeftCell.Address(0, 0)
        BRC = .BottomRightCell.Address(0, 0)
        T = .Type
     End With
End Sub
 

mwperkins

Board Regular
Joined
Oct 29, 2002
Messages
153
Many thanks for the reply. In the GetCommonDetails, is it possible to include resolution?
 

Forum statistics

Threads
1,081,982
Messages
5,362,543
Members
400,679
Latest member
alecalec202

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top