我正在尝试编写一个允许具有默认值的可选参数的 VBA 子程序。我尝试了Microsoft Docs - 可选参数 (Visual Basic)中的示例代码,但它导致子程序未显示在可用子程序列表中(即来自视图宏)。
\n\nSub notify(ByVal company As String, Optional ByVal office As String = "QJZ")\n If office = "QJZ" Then\n Debug.WriteLine("office not supplied -- using Headquarters")\n office = "Headquarters"\n End If\n \' Insert code to notify headquarters or specified office.\nEnd Sub\nRun Code Online (Sandbox Code Playgroud)\n\n我尝试过但无法出现的子声明是:
\n\nSub HighlightByFont( _\n Optional ByVal highlightFont As Variant = "", _\n Optional ByVal highlightColor As Variant = "", _\n Optional ByVal highlightText As Variant = "", …Run Code Online (Sandbox Code Playgroud) 在阅读了很多关于此的不同主题并尝试了一堆脚本后,我挠头,但似乎都没有工作。
我想使用 Automator 自动将 Word 2016 的精选 docx 文件转换为 pdf。
使用了以下 Automator 服务:
使用了以下脚本:
on run {input, parameters}
tell application id "com.microsoft.Word"
activate
open input
set doc to name of active window
set theOutputPath to (input & ".pdf")
save as active document file name theOutputPath file format format PDF
end tell
end run
Run Code Online (Sandbox Code Playgroud)
这会导致错误:Microsoft Word 出现错误:活动文档不理解“另存为”消息。