.InlineShapes.AddPicture不会转到书签。范围

时间:2018-08-02 08:15:52

标签: excel vba excel-vba ms-word word-vba

我需要在文本后面的书签位置插入表格Excel Vba图片

 Dim iShape As Word.InlineShape, myShape As Word.Shape
 '.Bookmarks.Item("Sign_Sign").Range
 Set iShape = .Range.InlineShapes.AddPicture(TemplatesShpSign_Sign, False, True, .Bookmarks.Item("Sign_Sign").Range)

 Set myShape = iShape.ConvertToShape
 With myShape
     .WrapFormat.Type = 5
 End With

没有一个人能正常工作

Set iShape = .Bookmarks.Item("Sign_Sign").Range.InlineShapes.AddPicture(TemplatesShpSign_Sign, False, True, .Bookmarks.Item("Sign_Sign").Range)    
Set iShape = .Range.InlineShapes.AddPicture(TemplatesShpSign_Sign, False, True, .Bookmarks.Item("Sign_Sign").Range)    
Set iShape = .Range.InlineShapes.AddPicture(TemplatesShpSign_Sign, False, True)    
Set iShape = .Bookmarks.Item("Sign_Sign").Range.InlineShapes.AddPicture(TemplatesShpSign_Sign, False, True)

图片始终位于页面顶部,而不是底部(书签位置)

那么如何将图片wdWrapBehind放置到书签位置?

没有Set myShape = iShape.ConvertToShape的图片转到正确的位置,但没有wdWrapBehind

1 个答案:

答案 0 :(得分:0)

您显示的第一个代码对我来说很好用。它的确包裹在后面:

Sub InsertShapeBookmark()
    Dim iShape As Word.InlineShape, myShape As Word.Shape
    Dim rng As Word.Range

     Set rng = ActiveDocument.Bookmarks.Item("Sign_Sign").Range
     Set iShape = rng.InlineShapes.AddPicture(TemplatesShpSign_Sign, False, True, rng)

     Set myShape = iShape.ConvertToShape
     With myShape
         .WrapFormat.Type = 5
     End With
End Sub
相关问题