Table of contents
TOC
折叠目录
展开目录

Application.SaveAsWebObject 属性 (Visio)Application.SaveAsWebObject Property (Visio)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

返回对VisSaveAsWeb对象的IDispatch接口的引用。只读的。Returns a reference to the IDispatch interface of a VisSaveAsWeb object. Read-only.

语法Syntax

表达式SaveAsWebObjectexpression . SaveAsWebObject

表达式_一个表示应用程序对象的变量。_expression A variable that represents an Application object.

返回值Return Value

对象Object

注解Remarks

VisSaveAsWeb对象的引用之后,可用于对象、 方法和属性在保存 Web 页 API 作为 Microsoft Visio 文档发布到 Web。有关保存为 Web 页的 API 的详细信息,搜索"另存为 Web 页 API"MSDN 上。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.

若要能够使用另存为 Web 页的 API,则必须获得 (VBA) 项目中您的 Microsoft Visual Basic 或 Microsoft Visual Basic for Applications 的Microsoft Visio 14.0 另存为 Web 类型库的引用。若要在 VBA 中获取此引用,请使用以下过程: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. 开发人员选项卡上的代码组中,单击Visual BasicIn the Code group on theDeveloper tab, click Visual Basic.

  2. 工具菜单上单击引用On the Tools menu, click References.

  3. 可用引用列表中,选择Microsoft Visio 14.0 另存为 Web 类型库并单击确定In the Available References list, select Microsoft Visio 14.0 Save As Web Type Library and click OK.

如果 Visual Studio 解决方案中包含Microsoft.Office.Interop.Visio的引用,该属性将映射到以下类型:If your Visual Studio solution includes the Microsoft.Office.Interop.Visio reference, this property maps to the following types:

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

示例Example

此 VBA 宏显示如何使用SaveAsWebObject属性来获取VisSaveAsWeb对象。它还演示了如何获取VisWebPageSettings对象、 配置 Web 页设置和创建 Web 页显示活动的 Visio 文档。宏获取 Visio应用程序对象并将其传递给SaveAsWeb过程,从而获取的VisSaveAsWeb对象,配置的设置,并创建 Web 页。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.

运行此宏之前,如上所述,获取对Microsoft Visio 14.0 另存为 Web 类型库的引用,并替换_路径 \ 文件名_的完整路径和名称您想要显示您计算机上创建.htm 文件的代码中Web 页。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 Web page.


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 = "path\filename " 

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

End Sub
© 2018 Microsoft