首页 > 解决方案 > 如何将 Excel 工作表上的图片名称转换为 VBA 变量

问题描述

在 Excel 中,我可以使用选择窗格来确定图片的名称。如何将这些名称放入 vba 层?

标签: excelvba

解决方案


我假设您正在寻找这样的东西:

Sub Test()
    Dim shp As Shape
    Dim shpName As String

    For Each shp In ActiveSheet.Shapes
        If shp.Type = msoPicture Then
            shpName = shp.Name
            Debug.Print shpName
        End If
    Next shp
End Sub

推荐阅读