TO button:
谢谢!已经可以完成这个保存图片的工作了
TO 守柔:
谢谢斑竹这段时间一直关心这个帖子,帮忙解决问题!
代码如下:
声明:
Private Declare Function OpenClipboard Lib "User32" (ByVal hWnd As Long) As Long
Private Declare Function CloseClipboard Lib "User32" () As Long
Private Declare Function GetClipboardData Lib "User32" (ByVal uFormat As Long) As Long
Private Declare Function CopyEnhMetaFileA Lib "Gdi32" (ByVal hemfSrc As Long, ByVal lpszFile As String) As Long
Private Declare Function DeleteEnhMetaFile Lib "Gdi32" (ByVal hdc As Long) As Long
过程:
public sub SavePic()
Application.ScreenUpdating = False
Dim WordFilePath
WordFilePath = ActiveDocument.Path & "\" & ActiveDocument.Name
Dim WordFileName
WordFileName = Left(ActiveDocument.Name, InStr(ActiveDocument.Name, ".") - 1)
Dim aShape As InlineShape, I As Integer, PicName As String
For Each aShape In ActiveDocument.InlineShapes
I = I + 1
PicName = ActiveDocument.Path & "\" & WordFileName & I & ".jpg"
aShape.Select
Selection.Copy
OpenClipboard 0
DeleteEnhMetaFile CopyEnhMetaFileA(GetClipboardData(14), PicName)
CloseClipboard
Next aShape
Application.ScreenUpdating = True
end sub
[此贴子已经被作者于2005-2-22 15:05:53编辑过] |