使用Excel VBA,我需要在Active Word文档中获取图片的名称。
这是我使用的代码:
Dim WordApp As Object
Dim DocumentoDestino As Object
Set DocumentoDestino = WordApp.ActiveDocument
MsgBox DocumentoDestino.Shapes(1).Name
还有:
Dim WordApp As Object
Dim DocumentoDestino As Object
Set DocumentoDestino = WordApp.ActiveDocument
MsgBox DocumentoDestino.InlineShapes(1).Name
但这些都不起作用。
错误消息为" 438: Object doesn't support this property or method
"。
答案 0 :(得分:0)
您需要先创建WordApp对象。
Dim WordApp As Word.Application
Dim DocumentoDestino As Document
Set WordApp = CreateObject("word.Application")
Set DocumentoDestino = WordApp.ActiveDocument