UIObject.LoadFromFile method (Visio)

Loads a Microsoft Visio application UIObject object from a file.


expression. LoadFromFile( _FileName_ )

expression A variable that represents a UIObject object.


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

Return value




Starting with Visio 2010, the Microsoft Office Fluent user interface (UI) replaced the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio, but they function differently.

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


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.

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 = "path\filename.vsu" 
 vsoUIObject.SaveToFile (strPath) 
 MsgBox ("Menus successfully saved to" & strPath) 
 'Load menus from the file. 
 vsoUIObject.LoadFromFile (strPath) 
 Visio.Application.SetCustomMenus vsoUIObject 
 MsgBox ("Menus successfully loaded from" & strPath) 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.