标签: word-2016

带默认值的 VBA Sub 可选参数

我正在尝试编写一个允许具有默认值的可选参数的 VBA 子程序。我尝试了Microsoft Docs - 可选参数 (Visual Basic)中的示例代码,但它导致子程序未显示在可用子程序列表中(即来自视图宏)。

\n\n
Sub 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\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试过但无法出现的子声明是:

\n\n
Sub 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)

vba ms-word default-value optional-parameters word-2016

6
推荐指数
2
解决办法
1万
查看次数

MacOS Automator + Applescript 用于将 docx 导出为 pdf 的解决方案

在阅读了很多关于此的不同主题并尝试了一堆脚本后,我挠头,但似乎都没有工作。

我想使用 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 出现错误:活动文档不理解“另存为”消息。

macos applescript ms-word automator word-2016

5
推荐指数
1
解决办法
5169
查看次数