|
本帖最后由 xifeng116 于 2019-8-23 10:32 编辑
以下是Word内容转图片的代码:
Sub yemiantopic()
Dim nIndex As Integer
On Error Resume Next
For nIndex = ActiveDocument.Content.Information(wdNumberOfPagesInDocument) To 1 Step -1
Selection.GoTo what:=wdGoToPage, Name:=nIndex
ActiveDocument.Bookmarks("\page").Range.Copy
ActiveDocument.Bookmarks("\page").Range.Select
Selection.PasteSpecial Link:=False, DataType:=wdPasteEnhancedMetafile, Placement:=wdInLine, DisplayAsIcon:=False
Next
MsgBox "转换结束!"
End Sub
按F8逐步执行代码可得正确结果(全部页面转为图片),直接执行代码就出错!只转换两页。去掉“On Error Resume Next”出现错误提示如下附图,不知问题出在哪里?
|
|