vb操作 word 把图片如何复制出来?
Private Sub Command5_Click()
Dim a As Object
Dim pnum As Long
Dim picturenum As Long
Set a = CreateObject("Word.Application")
a.Documents.Open (Text1.Text)
picturenum = ActiveDocument.InlineShapes.Count
'a.Visible = True
MsgBox picturenum
a.Quit
For pnum = 1 To picturenum Step 1
a.InlineShapes(pnum).Select'这一句 错误 ,怎么改。。。。
a.Application.Selection.Copy
Picture = Clipboard.GetData()
SavePicture Picture, Text1.Text + "\111" + pnum + ".bmp"
Next
End Sub
[解决办法]
'改成这样就OK了
Option Explicit
Private Sub Command5_Click()
Dim a As Object
Dim pnum As Long
Dim picturenum As Long
Set a = CreateObject("Word.Application")
a.Documents.Open ("c:\word1.doc")
picturenum = ActiveDocument.InlineShapes.Count
'a.Visible = True
'MsgBox picturenum
'a.Quit
For pnum = 1 To picturenum 'Step 1
'a.InlineShapes(pnum).Select '这一句 错误 ,怎么改。。。。
ActiveDocument.InlineShapes(pnum).Select
a.Application.Selection.Copy
Picture1.Picture = Clipboard.GetData()
SavePicture Picture1.Image, "c:\wordpicture.bmp" ' Text1.Text + "\111" + pnum + ".bmp"
Next
a.Quit
End Sub