【发布时间】:2014-07-29 19:59:36
【问题描述】:
当使用 Word for Mac 2011 和 Tools → Macro → Record New Macro 录制用于插入图片的 VBA 宏时,通过 Insert → Photo → Picture from File 图片将插入到您的文档中在录制过程中,但你最终会得到一个像这样的非功能宏:
Sub NotWorkin()
'
' NotWorkin Visual Basic for Applications Macro
'
'
Selection.InlineShapes.AddPicture fileName:= _
"/Users/mark/SMPTE_RP_219_2002.png", LinkToFile:=False, SaveWithDocument _
:=True
Selection.InlineShapes.AddPicture fileName:="", LinkToFile:=False, _
SaveWithDocument:=True
End Sub
当你尝试运行宏时,它会抛出一个错误:
Run-time error '5152':
This is not a valid file name.
Try one or more of the following:
* Check the path to make sure it was typed correctly.
* Select a file from the list of files and folders.
这是在 OS X(版本 10.8.5)和 Microsoft® Word for Mac 2011, 版本 14.4.3 (140616), 最新安装的更新:14.4.3
这里发生了什么,为什么宏不起作用?
【问题讨论】:
标签: macos vba ms-office ms-word