Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Running Save as Web Page from the command line
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
See also
The Save as Web Page feature is automatically installed with each Microsoft Visio 2002 product. It is installed as a Visio add-on with the name "SaveAsWeb."
To run Save as Web Page using the command-line interface, you call the Save as Web add-on with the desired command-line options.
Note The command-line interface is the only way to control Save as Web Page from a separate executable.
You can choose either of the following techniques:
- Create a formula using the RUNADDONWARGS function in a shape’s event section.
- Write a Microsoft Visual Basic macro in Visio (or code in a separate component) that launches the add-on using the Visio Automation object model. You can use the Run method of the Addon object and pass the command-line parameters to specify the properties of the Web page.
Save as Web Page command-line options
The format for command-line parameters look like the following:
/token = value
where token is the option, and value is the option’s value.
The following table lists the command-line options for the Save as Web Page command-line interface. The column titled Method/Property name lists the corresponding method or property in the object model. For details about a particular option, see the corresponding method or property topic in this reference.
Option |
Default |
Value type |
Method/Property name |
target |
Same as Source File Path |
Text |
|
pagetitle |
Same as document file name |
Text |
|
prop |
TRUE |
Boolean |
|
tabs |
TRUE |
Boolean |
|
altformat |
TRUE |
Boolean |
|
folder |
TRUE |
Boolean |
|
longnames |
TRUE |
Boolean |
|
theme |
Null |
Text |
|
startpage |
-1 (all pages) |
Number |
|
endpage |
-1 (all pages) |
Number |
|
openbrowser |
FALSE |
Boolean |
|
screenres |
800x600 |
Text/Number1 |
|
priformat |
VML |
Text/Number1 |
|
secformat |
GIF |
Text/Number1 |
|
silent |
FALSE |
Boolean |
|
quiet |
FALSE |
Boolean |
1 For the text/number value type, the user may specify text such as vml for the output type, or a number (for example, 1) representing the index of this output type. Each output type will have its own unique index. For screenres, text and number values are defined in VISWEB_DISP_RES.
Using the RUNADDONWARGS function
The following is an example of using the RUNADDONWARGS function to call the Save as Web Page add-on.
=RUNADDONWARGS("SaveAsWeb","/target=c:\temp\mypage.htm /quiet /prop /startpage=1 /endpage=3 /altformat /priformat=vml /secformat=jpg /openbrowser")
A previous scenario described a user being able to merely double-click a shape in a drawing to produce a Web page for that drawing. To demonstrate this, you can place the previous formula in the EventDblClick cell of the Events section in the ShapeSheet window of any shape on your drawing page (select a shape in the drawing window, then on the Window menu, click ShowShapeSheet). After the formula is entered into the ShapeSheet cell, you can double-click that shape in the drawing window and launch the Save as Web Page feature.
For more information about the RUNADDONWARGS function, the EventDblClick cell, and the Events section, see the Microsoft Visio Developer Reference (on the Help menu, click Developer Reference).
Calling the Run method of the SaveAsWeb add-on
The Save as Web Page feature is installed as a Visio add-on called SaveAsWeb and can be referenced through the Addons collection of the Visio Application object.
The following example demonstrates how to run the Save as Web Page add-on by passing command-line parameters to the Run method of the SaveAsWeb add-on.
In this example, the code that launches the add-on is contained in an event handler for the DocumentSaved event. The QuietMode is set to True so that the Save as Web Page dialogs are not displayed in the user interface.
Private Sub Document_DocumentSaved(ByVal Document As IVDocument)
Application.Addons("SaveAsWeb").Run "/quiet=True _
/target=C:\temp\test.htm"
End Sub
For more information about the Addons and Application objects, and the DocumentSaved event, see the Microsoft Visio Developer Reference (on the Help menu, click Developer Reference).