Hi,

I have a question. I've a userform that has a textfield. Next to it, there
is a button with caption "Browse". I was thinking that when user wants to
insert a picture, he/she clicks on "browse" that will bring up a filedialog
box for user to select which image file they want to insert to the document.
Once, they have chosen the file, the filepath will be captured and shown in
the textfield that is next to it. After user has filled out all the text
fields in the userform and press "ok" button, all the user data will be
dumped to the word document. I use bookmark to do this.

So, getting back to my question. i have a bookmark in the word document. I
was hoping, the image will be placed where the bookmark for the image is in
the word document.

I use the following code to bring up the filedialog but couldn't retrieve
the filepath to the textfield. Instead, it actually opens up the file.
Dialogs(wdDialogFileOpen).Show

I have tried to use the following codes
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)

but got error message saying "invalid property".

I have done this before in excel but the codes below doesn't work well with
word.
filein = Application.GetOpenFilename()

Your help would be greatly appreciated.

Thank you in advance

Re: issue with filedialog browser by Doug

Doug
Wed Apr 09 01:50:45 PDT 2008

The following code displays the Insert Picture dialog and then inserts the
path\filename for the selected picture into a textbox txtPicturePath on the
user form:

' Display the InsertPicture dialog
With Dialogs(wdDialogInsertPicture)
If .Display Then
'Populate the txtPicturePath control with the selected filename
txtPicturePath = WordBasic.FilenameInfo$(.Name, 1)
End If
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Associates" <Associates@discussions.microsoft.com> wrote in message
news:EAAB431A-360C-47A9-96A3-3184840BB3A0@microsoft.com...
> Hi,
>
> I have a question. I've a userform that has a textfield. Next to it, there
> is a button with caption "Browse". I was thinking that when user wants to
> insert a picture, he/she clicks on "browse" that will bring up a
> filedialog
> box for user to select which image file they want to insert to the
> document.
> Once, they have chosen the file, the filepath will be captured and shown
> in
> the textfield that is next to it. After user has filled out all the text
> fields in the userform and press "ok" button, all the user data will be
> dumped to the word document. I use bookmark to do this.
>
> So, getting back to my question. i have a bookmark in the word document. I
> was hoping, the image will be placed where the bookmark for the image is
> in
> the word document.
>
> I use the following code to bring up the filedialog but couldn't retrieve
> the filepath to the textfield. Instead, it actually opens up the file.
> Dialogs(wdDialogFileOpen).Show
>
> I have tried to use the following codes
> Dim dlgOpen As FileDialog
> Set dlgOpen = Application.FileDialog( _
> FileDialogType:=msoFileDialogOpen)
>
> but got error message saying "invalid property".
>
> I have done this before in excel but the codes below doesn't work well
> with
> word.
> filein = Application.GetOpenFilename()
>
> Your help would be greatly appreciated.
>
> Thank you in advance



Re: issue with filedialog browser by Jonathan

Jonathan
Wed Apr 09 01:51:45 PDT 2008

Which version of Office are you using? If I recall, the FileDialog object
isn't available in Office 2000, but was introduced in Office XP.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup



"Associates" <Associates@discussions.microsoft.com> wrote in message
news:EAAB431A-360C-47A9-96A3-3184840BB3A0@microsoft.com...
> Hi,
>
> I have a question. I've a userform that has a textfield. Next to it, there
> is a button with caption "Browse". I was thinking that when user wants to
> insert a picture, he/she clicks on "browse" that will bring up a
> filedialog
> box for user to select which image file they want to insert to the
> document.
> Once, they have chosen the file, the filepath will be captured and shown
> in
> the textfield that is next to it. After user has filled out all the text
> fields in the userform and press "ok" button, all the user data will be
> dumped to the word document. I use bookmark to do this.
>
> So, getting back to my question. i have a bookmark in the word document. I
> was hoping, the image will be placed where the bookmark for the image is
> in
> the word document.
>
> I use the following code to bring up the filedialog but couldn't retrieve
> the filepath to the textfield. Instead, it actually opens up the file.
> Dialogs(wdDialogFileOpen).Show
>
> I have tried to use the following codes
> Dim dlgOpen As FileDialog
> Set dlgOpen = Application.FileDialog( _
> FileDialogType:=msoFileDialogOpen)
>
> but got error message saying "invalid property".
>
> I have done this before in excel but the codes below doesn't work well
> with
> word.
> filein = Application.GetOpenFilename()
>
> Your help would be greatly appreciated.
>
> Thank you in advance