View Single Post
 
Old 11-13-2017, 02:01 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

1. Given that you're running a new Word session, you don't need CreateObject; you can use New instead.
2. You need to be specific as to which application your Shape belongs; otherwise it is assumed to belong to the calling app, not the called one.
3. You don't need ActiveWindow.Selection; instead you can tell Word precisely where the pic should go.

Try something along the lines of:
Code:
Dim wdApp As New Word.Application, wdDoc As Word.Document, wdShp As Word.Shape

wdApp.Visible = True
Set wdDoc = wdApp.Documents.Add
Set wdShp = wdDoc.InlineShapes.AddPicture(FileName:="C:\MyPicture.jpg", LinkToFile:=False, _
  SaveWithDocument:=True, Range:=wdDoc.Range.Characters.Last).ConvertToShape
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote