Results 1 to 5 of 5
  1. #1
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    UserForm file-picker control (Word 2002 SP-2)

    I realize I can combine a textbox, a command button, some code and the FilePicker FileDialog to do the job, but is there a readily-available UserForm control (from Microsoft or otherwise) that puts it all together in terms of allowing the user to easily choose a single file? I'm picturing something like a textbox with a small browse button at its right end, so the user can either type a filename or browse for a single file in a file-chooser dialog that's a built-in part of the control.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: UserForm file-picker control (Word 2002 SP-2)

    Why not display Word's built-in FileOpen dialog? If you want to open the file selected by the user, use the Show method of the dialog; if you only want to retrieve the file name, use the Display method:

    Sub ShowOpenDialog()
    With Dialogs(wdDialogFileOpen)
    If .Display = True Then
    MsgBox "You selected " & .Name & ".", vbInformation
    Else
    MsgBox "You canceled the dialog.", vbExclamation
    End If
    End With
    End Sub

  3. #3
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: UserForm file-picker control (Word 2002 SP-2)

    Thanks for the prompt response.

    The control for the filename input is one of several input controls that I envisioned would be on a single UserForm, with the user having the option of either typing the path and name in the box or browsing for it. As I noted in my initial post, I realize I could combine a textbox with a command button with code that summoned a separate file-chooser dialog. WordPerfect has long had a file-picker dialog control that puts that all together, and I wondered if there was a similar control for Office UserForms.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: UserForm file-picker control (Word 2002 SP-2)

    I'm not aware of such a control, but perhaps someone else knows of one.

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: UserForm file-picker control (Word 2002 SP-2)

    It would be fairly easy to have a button on your form that ran the code Hans suggested and put the output on a label on the form.

    StuartR

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •