在Excel文件中输出插入图像的文件名

我从客户端收到一个带有数百个直接插入文件的图像的大型.xlsx文件。

我试图以编程方式或用macros在新列中输出图像的名称(或更好的文件名)。

你能指点我正确的方向吗?

预先感谢您的时间。

希望这对你有所帮助。

 Sub takePictureNames() Dim i As Integer 'use as index Dim Pic 'to store pictures in worhsheet i = 0 'init the index For Each Pic In ActiveSheet.Shapes i = i + 1 'add 1 every time Cells(i, 1).Value = Pic.Name 'Cells({a}, {b}).value = {c} 'a = the row. Using the index to take a row at the time 'b = define the columns you want, with a variable or hardcoded as I did 'c = inside the Pic variable, you store a picture, one at the time, and then take the name of the pic 'Remember: The name of the picture is the name that excel gives to the picture once is inserted, not an 'actual file name. But if you want to use it to run a macro, will be usefull to that that name (the excel name) Next Pic End Sub 

评论中的解释。