Insert Picture/Graphics Filter problem

V

Vivian Carroll

In Word 2002, I used the code below in one template and it works fine. Now I
have put the same code into a new template and when it gets to the
".Execute" line I get error code 5382 "Graphics filter unable to onvert this
file...". (Same computer, same version of Word 2002.) I am able to insert
the picture into the template manually using Insert, Picture, from File.
What do I need to do to the code to make it insert the chosen picture?

TIA,
Vivian

With Dialogs(wdDialogInsertPicture)
'If the user picks a file, insert it
If .Display = -1 Then
.Execute
'If the user clicks Cancel, close the dialog and end the macro
Else
Exit Sub
End If
End With
 
J

Joost Verdaasdonk

Hi Vivian,

You're code should run fine! (on my XP machine it does)

But perhapse you are having problems with object bindings.

Try this code instead:
Sub InsPic()
Dim dlg As Dialog

Set dlg = Dialogs(wdDialogInsertPicture)
With dlg
If .Display = -1 Then
.Execute
Else
GoTo IExit
End If
End With
IExit:
Set dlg = Nothing
End Sub

Enjoy! ;-)
 
V

Vivian Carroll

Thanks Joost, but I have the same problem with the code that you supplied.

Vivian
 
V

Vivian Carroll

Sorry to have bothered everyone who read this.

The problem was that I was trying to use the code to insert a picture into
the template itself - that gives the error. Trying to insert the picture
into a document created from the template works just fine.

Vivian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top