0

我们的客户端环境最近从 word 2000 迁移到 2003,我们在其中一个模板中使用以下代码来显示 word 的默认插入文件对话框。Word 与另一个第三方应用程序 Hummingbird docspen 集成。

 With Dialogs(wdDialogInsertFile)
       .Name = "q:\*.*"

       .Show

   End With

在旧环境中,它会打开指向我的文档文件夹的默认插入文件对话框,而在 word 2003 中,它会打开 Docsopen 插入文件对话框。

我比较了 word 2000 和 2003 的设置,似乎是一样的。

请对此提出任何建议。

4

1 回答 1

0

抱歉,我无法在 Word 2003 / Win XP 上重现此内容。复制/粘贴您的代码并获得“插入文件”对话框。唯一不起作用的是指向您的目录q:

为此,您必须首先设置 Options.DefaultFilePath(wdDocumentsPath) ,如

Private Sub CommandButton1_Click()

' save current doc path and set to insert path
MyPath = Options.DefaultFilePath(wdDocumentsPath)
Options.DefaultFilePath(wdDocumentsPath) = "C:\"

' display insert file dialog
With Dialogs(wdDialogInsertFile)  ' this works in debug mode as well as on clicking Command Button from Doc
    .Name = "*.txt"
    .Show
End With

' restore original doc path
Options.DefaultFilePath(wdDocumentsPath) = MyPath

End Sub

祝你好运

于 2009-12-15T10:42:59.183 回答