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

Insert Picture/Graphics Filter problem by Joost

Joost
Sun Aug 29 14:23:49 CDT 2004

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! ;-)
>-----Original Message-----
>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
>
>
>.
>

Re: Insert Picture/Graphics Filter problem by Vivian

Vivian
Sun Aug 29 17:10:04 CDT 2004

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

Vivian

"Joost Verdaasdonk" <anonymous@discussions.microsoft.com> wrote in message
news:255001c48dfd$b5fa5260$a301280a@phx.gbl...
> 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! ;-)
> >-----Original Message-----
> >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
> >
> >
> >.
> >



Re: Insert ... My Dumb Error by Vivian

Vivian
Sun Aug 29 20:46:05 CDT 2004

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

"Joost Verdaasdonk" <anonymous@discussions.microsoft.com> wrote in message
news:255001c48dfd$b5fa5260$a301280a@phx.gbl...
> 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! ;-)
> >-----Original Message-----
> >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
> >
> >
> >.
> >