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 

好運