List properties of images in workbook

mwperkins

Board Regular
Joined
Oct 29, 2002
Messages
156
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
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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
 
Upvote 0
Solution

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top