VisWebPageSettings.TargetPath property

Specifies the path where the webpage and its supporting files are placed. Read/write.

Syntax

expression.TargetPath

expression An expression that returns a VisWebPageSettings object.

Return value

String

Remarks

When you save a drawing as a webpage, you must use the TargetPath property to supply the full target path. The TargetPath property is reset to a null value after each export; each time you save a drawing as a webpage you must explicitly supply the target path. In addition, the TargetPath value is not persisted between sessions of Visio.

The value of the TargetPath property corresponds to the folder name and file name selected in the Save As dialog box (BackstageButton tab > Save As).

Example

The following macro shows how to save the active document as a webpage and place the resulting HTML file and supporting files as flat files in the targetpath folder. Because the StoreInFolder property is set to False, the supporting files are placed in the same folder as the root HTML file, instead of in a separate folder that has the name filename_files or filename.files, depending on the language.

Public Sub TargetPath_Example()
    Dim vsoSaveAsWeb As VisSaveAsWeb 
    Dim vsowebSettings As VisWebPageSettings

    Set vsoSaveAsWeb = Visio.Application.SaveAsWebObject 
    Set vsoWebSettings = vsoSaveAsWeb.WebPageSettings
 
    With vsoWebSettings
         .StoreInFolder = False
         .TargetPath = "<variable>targetpath\filename.htm</variable>"
    End With
 
    vsoSaveAsWeb.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.