會傳回 VisSaveAsWeb 物件的 IDispatch 介面的參考。 唯讀。
語法
表情。SaveAsWebObject
expression 代表 Application 物件的變數。
傳回值
物件
註解
一旦你取得 VisSaveAsWeb 物件的參考,就可以利用 Save as 網頁 API 的物件、方法和屬性,將 Microsoft Visio 文件發佈到網路。 如需另存成網頁 API 的詳細資訊,請在 MSDN 上搜尋「另存成網頁 API」。
若要使用 Save as 網頁 API,您必須取得 Microsoft Microsoft Visio 14.0 另存為網頁型庫 的參考,或 VBA) 專案中的 Visual Basic for Applications (Microsoft。 若要在 VBA 中引用這個項目,請使用下列步驟:
在開發者標籤的程式碼群組中,點選 Visual Basic。
按一下 [工具] 功能表中的 [參照]。
選取 [可用的參考] 清單中的 [Microsoft Visio 14.0 Save As Web Type Library],然後按一下 [確定]。
如果 Visual Studio 解決方案包括 Microsoft.Office.Interop.Visio 參照,這個屬性會對應至下列類型:
- Microsoft.Office.Interop.Visio.IVApplication.SaveAsWebObject
範例
這個 VBA 巨集展示了如何使用 SaveAsWebObject 屬性來取得 VisSaveAsWeb 物件。 它也展示了如何取得 VisWebPageSettings 物件、設定網頁設定,以及建立網頁以顯示活躍的 Visio 文件。 巨集會接收 Visio Application 物件,並傳給 SaveAsWeb 程序,程序會取得 VisSaveAsWeb 物件、設定並建立網頁。
執行此巨集前,先取得上述 Microsoft Visio 14.0 另存為網頁型式庫 的參考,並在程式碼中替換 path\filename 成你想在電腦上建立的 .htm 檔案的完整路徑與名稱,以便顯示該網頁。
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
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。