Sign in to follow this  
Followers 0
Kohr

Help with inserting pictures in word

2 posts in this topic

I am trying to insert pictures into a Word document using the following code. I have not been able to get "Shapes.AddPicture" to work using several different combinations. Has anyone had any luck with inserting pictures into word?

"$word.Selection.Paste" works but it puts the image in as a .bmp file and I will need to insert lots of images.

$word = ObjCreate("Word.Application")
$word.visible = False
$word.Documents.Add

Dim $FileName
$FileName = "C:\Documents and Settings\All Users\Desktop\dump_full.jpg"
$word.Activedocument.Shapes.AddPicture ($FileName, False, True, 0, 0, 0, 0, 0)

$word.ChangeFileOpenDirectory( @DesktopDir )
$word.Activedocument.SaveAs( "test.doc" )
$word.Application.Quit

Kohr

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0