2009-10-13 60 views
0

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

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

     .Show 

    End With 

在旧环境中它打开了默认的insertFile对话框指着我的文档文件夹,其中如在Word 2003中,它打开了Docsopen的insertFile对话框。

我比较了Word 2000和2003的设置,它似乎是相同的。

对此有任何建议。

回答

0

对不起,我不能在Word 2003/Win XP上重现此操作。复制/粘贴您的代码并获得“插入文件”对话框。唯一不工作是指你的目录问:

对于这一点,你必须设置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 

好运