“VBA Word 2003”对话框

“VBA Word 2003”对话框,vba,word-2003,Vba,Word 2003,我们的客户端环境最近从word 2000迁移到2003,我们在其中一个模板中使用以下代码来显示word的默认“插入文件”对话框。Word与另一个第三方应用程序Hummingbird docspen集成 With Dialogs(wdDialogInsertFile) .Name = "q:\*.*" .Show End With 在旧环境中,它会打开指向“我的文档”文件夹的默认insertfile对话框,在word 2003中,它会打开Docsopen

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

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

       .Show

   End With
在旧环境中,它会打开指向“我的文档”文件夹的默认insertfile对话框,在word 2003中,它会打开Docsopen insertfile对话框

我比较了Word2000和2003的设置,看起来是一样的


请对此提出任何建议。

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

为此,必须首先设置选项.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
祝你好运