簡體   English   中英

VBA 能否打開嵌入在 Excel 工作簿中的文檔

[英]Can VBA open a document embedded in an Excel workbook

如果我想用 VBA 從 Excel 打開 a.oft 文檔,我通常會在 VBA 中指明 .oft 文檔的文件夾路徑。

是否可以在 Excel 文件中附加/嵌入 this.oft 並指示 VBA 從 Excel 文件打開它而不是指示文件夾路徑?

謝謝!

這是 Word 中 VB.NET 的代碼示例,讓您了解需要使用的代碼結構。 Note that the Excel VBA model and Word VBA model differ and sometimes use different function/method names (I don't know for sure but this sometimes happens). 只需搜索 Microsoft 的指南即可。

For Each shp As InlineShape In wordDoc.Content.InlineShapes
  If shp.Type = WdInlineShapeType.wdInlineShapeEmbeddedOLEObject Then
     If shp.OLEFormat.ProgID.Contains("Word") Then
        shp.open()  ' Open the embedded Word document
     end if
  end if
next

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM