Share via


AttachToVisioDoc Method

Visio Save As Web Reference

Indicates which document to save as a Web page.

Syntax

expression.AttachToVisioDoc(docObj)

expression   An expression that returns a VisSaveAsWeb object.

Parameters

Name Required/Optional Data Type Description
docObj Required Document An Automation object that supports the IVDocument interface.

Return Value
Nothing

Remarks

Microsoft Visual Basic programs can pass a Visio Document object to this method because objects created from the Visio Document class support the IVDocument interface.

The AttachToVisioDoc method queries the IUnknown interface for the presence of the IVDocument interface.

Example

The following example shows how to open an existing file and save it as a Web page by using the Save as Web Page feature's default settings and the AttachToVisioDoc and CreatePages methods. Before running this example, replace path\filename with a valid path and file name for a Visio document to pass to the Open method. In addition, replace targetpath\filename with a valid target path and a file name for the Web page project files.

Visual Basic for Applications
  Public Sub AttachToVisioDoc_Example () 
    Dim vsoSaveAsWeb As VisSaveAsWeb 
    Dim vsoWebSettings As VisWebPageSettings 
    Dim vsoDocument As Visio.Document
 
    Set vsoDocument = Application.Documents.Open("path\filename") 
    Set vsoSaveAsWeb = Visio.Application.SaveAsWebObject
    Set vsoWebSettings = vsoSaveAsWeb.WebPageSettings
 
    vsoWebSettings.TargetPath = "targetpath\filename"
With vsoSaveAsWeb
    .AttachToVisioDoc vsoDocument
    .CreatePages 
End With

End Sub

See Also