Hi Jean Guy,
Thanks for the "heads up" on the ability to merely use .Name in XP (and
2003) to get the File Path and Name. When VBA first appeared with
Word97, I
don't think that was the case.
Now of course, if you just want to get the filename and the path (without
parsing the string), you need to use:
WordBasic.FilenameInfo$(.Name, 0)
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
Hi Doug,
Thanks... indeed I'll sleep better!
I see now why I missed that... I always give my user the option of
cancelling when I pop up dialog boxes. Oftentimes, that is when the
user
realizes that he/she has forgotten something, (i.e. when they see the list
of files...). So I would use something like:
'_______________________________________
Dim PicFile As String
With Dialogs(wdDialogInsertPicture)
.Display
If Not .Name = "" Then
PicFile = .Name
Else
MsgBox "Action cancelled by user", vbExclamation,
"Cancelled"
Exit Sub 'or other appropriate "undo" stuff...
End If
End With
'_______________________________________
to handle a user cancellation in this particular case.
Finally, a last question:
I see you use
WordBasic.FilenameInfo$(.Name, 1)
Is this because in previous versions of Word only the file name was
returned? Under XP, ".Name" returns the full path and file name...
Thanks again for your time.
--
_______________________________________
Jean-Guy Marcil
(e-mail address removed)
"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
<
[email protected]> a écrit dans le message de #
[email protected]...
Hi Jean Guy,
Try clicking the Cancel button in the dialog with and without the If End
If
and I believe that you will sleep better tonight.
--
Please post any further questions or followup to the newsgroups for
the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
Hi Doug,
A quick question:
Why the
If End If
around the
.Display Then
PicFile = WordBasic.FilenameInfo$(.Name, 1)
lines?
It works just as well without... So, I am wondering if you could
help
me
go
to bed less stupid tonight!
TIA
--
_______________________________________
Jean-Guy Marcil
(e-mail address removed)
"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL
ADDRESS"
<
[email protected]> a écrit dans le message de (e-mail address removed)...
Hi Tyrin,
Dim PicFile as string
With Dialogs(wdDialogInsertPicture)
If .Display Then
'Populate the txtLargeLogoPath control with the
selected
filename
PicFile = WordBasic.FilenameInfo$(.Name, 1)
End If
End With
The above code will display the Insert Picture dialog and the
path\filename
of the selected picture will be loaded into the variable PicFile.
Please post any further questions or followup to the newsgroups for
the
benefit of others who may be interested. Unsolicited questions
forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
Hi all, I'm trying to insert a picture into a word document