Document.CustomMenusFile プロパティ (Visio)

Document オブジェクトのユーザー設定メニューおよびアクセラレータを定義するファイルの名前を設定します。 値の取得と設定が可能です。

構文

CustomMenusFile

Document オブジェクトを表す変数。

戻り値

文字列

注釈

注:

Visio 2010 以降、Microsoft Office Fluent ユーザー インターフェイス (UI) は、階層化されたメニュー、ツールバー、および作業ウィンドウの以前のシステムに置き換わりました。 以前のバージョンの Visio でユーザー インターフェイスをカスタマイズするために使用した VBA オブジェクトとメンバーは、Visio で引き続き利用できますが、機能が異なります。

オブジェクトがユーザー設定メニューを使用していない場合は、CustomMenusFile プロパティは Nothing を返します。

この Microsoft Visual Basic for Applications (VBA) マクロは、アプリケーション レベルのユーザー設定 UI を置き換えずに図面用の現在アクティブな UI を取得する方法を示しています。 また、このマクロは既存のユーザー設定メニューをファイルに保存し、保存されたメニューが現在の図面で使用されるように指定します。 ユーザー設定 UI 項目を追加する場合は、追加のコードを記述する必要があります。

注:

このマクロは、VBA キーワード (keyword) Kill を使用してディスク上のファイルを削除します。 Kill コマンドの実行後は元に戻すことができず、事前の警告メッセージも表示されないため、このキーワード (keyword) は慎重に使用してください。

 
Sub CustomMenusFile_Example() 
 
 Dim vsoUIObject As Visio.UIObject 
 Dim strPath As String 
 
 'Check whether there are custom menus bound to the document. 
 If ThisDocument.CustomMenus Is Nothing Then 
 
 'If not, check whether there are custom menus bound to the application. 
 If Visio.Application.CustomMenus Is Nothing Then 
 
 'If not, use the Visio built-in menus. 
 Set vsoUIObject = Visio.Application.BuiltInMenus 
 MsgBox "Using Built-In Menus", 0 
 
 Else 
 
 'If there are existing Visio custom menus, use them. 
 Set vsoUIObject = Visio.Application.CustomMenus 
 
 'Save these custom menus to a file. 
 strPath = Visio.Application.Path & "\CustomUI.vsu" 
 vsoUIObject.SaveToFile (strPath) 
 
 'Set the document to use the existing custom UI. 
 ThisDocument.CustomMenusFile = strPath 
 
 'Get this document's UIObject object. 
 Set vsoUIObject = ThisDocument.CustomMenus 
 
 'Delete the newly created temp file. 
 Kill Visio.Application.Path & "\CustomUI.vsu" 
 ThisDocument.ClearCustomMenus 
 MsgBox "Using Custom Menus", 0 
 
 End If 
 
 Else 
 
 'Use the existing custom menus. 
 Set vsoUIObject = ThisDocument.CustomMenus 
 
 End If 
 
End Sub

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。