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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

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