次の方法で共有


UIObject.Clone プロパティ (Visio)

UIObject オブジェクトのコピーを返します。 読み取り専用です。

構文

Clone

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

戻り値

Uiobject

この例は、Clone プロパティを使って、UIObject オブジェクトのコピーを作成する方法を示します。 このサンプルは、複製されたツールバー コレクションにカスタム ツールバーを追加します。 このツールバーは、Microsoft Visio ユーザー インターフェイスに表示され、図面がアクティブなときに使用できます。

このマクロの実行後、Visio の組み込みのツールバーを復元するには、ThisDocument.ClearCustomToolbars メソッドを呼び出してください。

 
Sub Clone_Example() 
 
 Dim vsoUIObject As Visio.UIObject 
 Dim vsoToolbars As Visio.Toolbars 
 Dim vsoToolbar As Visio.Toolbar 
 
 'Check whether there are document custom toolbars. 
 If ThisDocument.CustomToolbars Is Nothing Then 
 
 'Check whether there are application custom toolbars. 
 If Visio.Application.CustomToolbars Is Nothing Then 
 
 'Use the built-in toolbars. 
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0) 
 
 Else 
 
 'Use the application custom toolbars. 
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone 
 
 End If 
 
 
 Else 
 
 'Use the document custom toolbars. 
 Set vsoUIObject = ThisDocument.CustomToolbars 
 
 End If 
 
 'Get the Toolbars collection for the drawing window context. 
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID(Visio.visUIObjSetDrawing).Toolbars 
 
 'Add a toolbar to the collection. 
 Set vsoToolbar = vsoToolbars.Add 
 
 'Set the title of the toolbar. 
 vsoToolbar.Caption = "My New Toolbar" 
 
 'Tell Visio to use the new UIObject object while 
 'this document is active. 
 ThisDocument.SetCustomToolbars vsoUIObject 
 
End Sub

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

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