确有楼主所说的情况,但PNG图片是可见的。 以下代码供参考: '* +++++++++++++++++++++++++++++
'* Created By I Love You_Word!@ExcelHome 2005-7-30 18:54:57
'仅测试于System: Windows NT Word: 10.0 Language: 2052
'^The Code CopyIn [ThisDocument-ThisDocument]^'
'* -----------------------------Option Explicit
Sub ExampleToInsertPng()
Dim MyDialog As FileDialog, vrtSelectedItem As Variant, MyRange As Range
On Error Resume Next '忽略错误
'设置查找文件时 Word 所指向的文件夹
Application.ScreenUpdating = False
Application.ChangeFileOpenDirectory "C:\Documents and Settings\My Documents\temp\1"
'定义一个文件夹选取对话框
Set MyDialog = Application.FileDialog(msoFileDialogFilePicker)
With MyDialog
.Filters.Clear '清除所有文件筛选器中的项目
.Filters.Add "PNG文件", "*.png", 1 '增加筛选器的项目为所有WORD文件
.AllowMultiSelect = True '允许多项选择
If .Show = -1 Then '确定
With ActiveDocument
For Each vrtSelectedItem In MyDialog.SelectedItems '在所有选取项目中循环
Set MyRange = .Range(.Content.End - 1, .Content.End - 1)
.Shapes.AddPicture FileName:=vrtSelectedItem, Anchor:=MyRange
.Content.InsertAfter Chr(13)
Next vrtSelectedItem
End With
End If
End With
Application.ScreenUpdating = True
End Sub
'---------------------- |