VBA判断word文档中有否存在嵌入式图片
- 2019-05-31 15:17:00
- tmtony8 原创
- 6211
可以通过 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 |