Share via


UIObject.LoadFromFile Method

Visio Automation Reference

Loads a Microsoft Office Visio application UIObject object from a file.

Version Information
 Version Added:  Visio 4.0

Syntax

expression.LoadFromFile(FileName)

expression   A variable that represents a UIObject object.

Parameters

Name Required/Optional Data Type Description
FileName Required String The name of the file to load.

Return Value
Nothing

Remarks

You must use the SaveToFile method to save a UIObject object in a file that the LoadFromFile method can load.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to save and then load a custom user interface file (.vsu). It does not manipulate any menus or menu items.

Before running this code, replace path\filename with the full path to and name of a valid .vsu file on your computer.

Visual Basic for Applications
  
Public Sub LoadFromFile_Example()
Dim vsoUIObject As Visio.UIObject 
Dim strPath As String

'Get Menus object from Visio.
Set vsoUIObject = Visio.Application.BuiltInMenus 

'Save Menus object to a file. 
strPath = "<em>path\filename.vsu</em>" 
vsoUIObject.SaveToFile (strPath) 
MsgBox ("Menus successfully saved to " &amp; strPath)

'Load menus from the file. 
vsoUIObject.LoadFromFile (strPath) 
Visio.Application.SetCustomMenus vsoUIObject 
MsgBox ("Menus successfully loaded from " &amp; strPath) 

End Sub

See Also