Share via


Application.SaveAsWebObject Property

Visio Automation Reference

Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.

Version Information
 Version Added:  Visio 2003

Syntax

expression.SaveAsWebObject

expression   A variable that represents an Application object.

Return Value
Object

Remarks

Once you have a reference to the VisSaveAsWeb object, you can use the objects, methods, and properties of the Save as Web Page API to publish Microsoft Office Visio documents to the Web. For more information about the Save as Web Page API, search for "Save as Web Page API" on MSDN.

To be able to work with the Save as Web Page API, you must get a reference to the Microsoft Visio 12.0 SaveAsWeb Type Library in your Microsoft Visual Basic or Microsoft Visual Basic for Applications (VBA) project. To get this reference in VBA, use the following procedure:

  1. On the Tools menu, point to Macros, and then click Visual Basic Editor.
  2. On the Tools menu, click References.
  3. In the Available References list, select Microsoft Visio 12.0 SaveAsWeb Type Library and click OK.

Example

This VBA macro shows how to use the SaveAsWebObject property to get a VisSaveAsWeb object. It also shows how to get a VisWebPageSettings object, configure Web-page settings, and create a Web page to display the active Visio document. The macro gets a Visio Application object and passes it to the SaveAsWeb procedure, which gets the VisSaveAsWeb object, configures the settings, and creates the Web page.

Before running this macro, get a reference to the Microsoft Visio 12.0 SaveAsWeb Type Library as described above, and replace path\filename in the code with the full path to and name of the .htm file you want to create on your computer to display the Web page.

Visual Basic for Applications
  
Public Sub SaveAsWebObject_Example
Dim vsoApplication as Visio.Application
Call SaveAsWeb(vsoApplication)

End Sub

Public Sub SaveAsWeb (vsoApplication as Visio.Application)

Dim objSaveAsWeb As IVisSaveAsWeb
Dim objWebPageSettings As IVisWebPageSettings

' Get a VisSaveAsWeb object that 
' represents a new Web page project
Set objSaveAsWeb = Application.SaveAsWebObject

' Get a VisWebPageSettings object
Set objWebPageSettings = objSaveAsWeb.WebPageSettings

' Configure Web-page settings
objWebPageSettings.StartPage = 1
objWebPageSettings.EndPage = 2
objWebPageSettings.LongFileNames = True
objWebPageSettings.TargetPath = "<em>path\filename</em>"

' Now create the pages; because we did not identify 
' a particular document, the active document is saved
objSaveAsWeb.CreatePages

End Sub

See Also