0

私たちのクライアント環境は最近 Word 2000 から 2003 に移行されました。テンプレートの 1 つで以下のコードを使用して、Word のデフォルトのファイル挿入ダイアログ ボックスを表示します。Word は、別のサード パーティ製アプリケーション Hummingbird docspen と統合されています。

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

       .Show

   End With

古い環境では、ドキュメント フォルダーを指すデフォルトの挿入ファイル ダイアログ ボックスが開きますが、Word 2003 では、Docsopen 挿入ファイル ダイアログ ボックスが開きます。

Word 2000 と 2003 の設定を比較しましたが、同じようです。

これに関する提案をお願いします。

4

1 に答える 1

0

申し訳ありませんが、Word 2003 /WinXPでは再現できません。コードをコピーして貼り付け、[ファイルの挿入]ダイアログボックスを表示します。動作しないのは、ディレクトリ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 に答える