|   |  | 
 | 
 
 | 
		|  | 
    
		| 
				
				
			 | 
	
	
		| 
				Visio
			 | 
				Export all Visio pages as HTML
			 | 
				 | 
	
		| 
				Ease of Use
			 | 
				Easy
			 | 
	
		| 
				Version tested with
			 | 
				2003 
			 | 
	
		| 
				Submitted by:
			 | 
				Brandtrock
			 | 
		
		| 
				Description:
		 | 
					Export all Visio pages in the document as HTML to the same path the Visio document resides in. 
			 | 
	
		| 
				Discussion:
			 | 
				Saving each sheet of the Visio Document as an HTML file.  Each page will get it's own folder with all of the elements necessary to use as a web page. 
			 | 
	
	
		| 
				Code:
			 | 
				 
					instructions for use
				
			 | 
	
		| 
			Option Explicit 
 
Sub ExportHTML() 
    Dim PgObj    As Visio.Page 
    Dim Pgs      As Visio.Pages 
    Dim filename As String 
    Dim PgName   As String 
    Dim iPgs     As Integer 
     
     
    Set Pgs = Application.ActiveDocument.Pages 
     
     
    For iPgs = 1 To Pgs.Count 
         
        Set PgObj = Pgs(iPgs) 
         
         
        PgName = PgObj.Name 
         
        filename = Application.ActiveDocument.Path & PgName & ".html" 
         
        PgObj.Export filename 
    Next iPgs 
     
     
    Set PgObj = Nothing 
    Set Pgs = Nothing 
End Sub 
 
 | 
	
		| 
			
				How to use:
			 | 
				 Open your Visio document.
Press Alt + F11 to launch the Visual Basic Editor (VBE).
Select Insert>Module from the Menu Bar in the VBE.
Copy the code from above.
Paste the code in the right hand window of the VBE.
Close the VBE.
From the Visio document, select Tools>Macro>Macros (or press Alt + F8).
Highlight ExportHTML  in the list of macros.
Press run.
 | 
	
		| 
				Test the code:
			 | 
				 Open the example file.
Run the ExportHTML macro per the instructions above.
When you are convinced that it works right, place the code in your document and run it.
 | 
	
		| 
				Sample File:
			 | 
					VBAX_Visio4.zip 168.03KB 
			 | 
    
		| 
				Approved by mdmackillop
			 | 
    
		| 
				
			 
			
 
This entry has been viewed 93 times.
 | 
    
		| 
				
				
			 |