VBA判斷word文檔中有否存在嵌入式圖片
- 2019-05-31 15:17:00
- tmtony8 原創
- 6213
可以通過 word文檔中的inlineshape對象的數量進行判斷,如下代碼:
Sub ExitsPic() Dim doc As Document '當前打開的文檔對象Document Dim MyApp As Word.Application 'Word應用程序對象 Dim strFileName As String '當前打開的文件名 strFileName = "D:\1.docx" '此處可以改成你的文件名字 Set MyApp = CreateObject("Word.Application") Set doc = MyApp.Documents.Open(strFileName) Debug.Print doc.InlineShapes.Count If doc.InlineShapes.Count <> 0 Then MsgBox "有嵌入式圖片存在!" End If End Sub
在“D:\1.docx”文檔文件中,含有一箇嵌入式圖片
運行代碼後,判斷有嵌入式圖片存在。
文章分類
聯繫我們
聯繫人: | 王先生 |
---|---|
Email: | 18449932@qq.com |
QQ: | 18449932 |
微博: | officecn01 |