Hi sasdde,
I know nothing of SAS, but from from I can see in your code there is no reference to either a textbox or a bookmark.
You say you've been able to insert the picture into the document using a bookmark. Have you tried putting the bookmark
inside the textbox? Also, when inserting a picture into a textbox, it has to be inserted in the 'in-line with text' format (ie as an inlineshape).
As I understand it, you can impelement both Wordbasic and VBA in SAS. The VBA equivalent would be:
Code:
ActiveDocument.InlineShapes.AddPicture "C:\Users\picture.jpg", , , ActiveDocument.Shapes(1).TextFrame.TextRange
or
With ActiveDocument.Shapes(1).TextFrame
.TextRange.InlineShapes.AddPicture "C:\Users\picture.jpg", , , .TextRange
End With
where the textbox is the first shape object in the document. If you put a bookmark into the shape, though, the code becomes:
Code:
ActiveDocument.InlineShapes.AddPicture "C:\Users\picture.jpg", , , ActiveDocument.Bookmarks("BkMk").Range
or
With ActiveDocument.Bookmarks("BkMk")
.Range.InlineShapes.AddPicture "C:\Users\picture.jpg", , , .Range
End With
where 'BkMk' is your bookmark name.
As you can see, with the bookmark, there's no need to reference the textbox, or know which of any number of shapes in the document it might be.