Upravit

Sdílet prostřednictvím


Application.SaveAsWebObject property (Visio)

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

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 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 14.0 Save As Web 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. In the Code group on the Developer tab, click Visual Basic.

  2. On the Tools menu, click References.

  3. In the Available References list, select Microsoft Visio 14.0 Save As Web Type Library and click OK.

If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

  • Microsoft.Office.Interop.Visio.IVApplication.SaveAsWebObject

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 webpage 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 webpage.

Before running this macro, get a reference to the Microsoft Visio 14.0 Save As Web 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 webpage.

 
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 webpage 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 = "path\filename " 
 
    ' Now create the pages; because we did not identify  
    ' a particular document, the active document is saved 
    objSaveAsWeb.CreatePages 
 
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.