Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Colorado, USA
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calling Office Get File Name from VBA (Access 2000)

    I'm currently using the Get File Name function that is part of the file msaccess.exe (alias "#56") to select files and/or directories on the disk. It came out of the Access Developer's Handbook for Access 97.

    It works great for selecting an EXISTING file or directory. However, I now want to allow the user the ability to enter a file name in the dialog in the "File name" field that doesn't exist on the disk and have it return the selected directory with the entered file name appended. Is it possible to do this or do I need to have the used select a location only and then enter a file name in a different dialog?

    Unfortunately, I don't have access to my ADH right now or I'd look there.

    Thanks.

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling Office Get File Name from VBA (Access 2000)

    Look into the SHBrowseForFolder API function. It has this: BIF_EDITBOX = &H10 constant (switch) that allows the user to type in a name AND this constant: BIF_USENEWUI = &H40 that allows new folder creation.

    Don't know it that's exactly what you need, but check it out anyway. May be of use in other situations.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Calling Office Get File Name from VBA (Access 2000)

    Are you talking about the GetFilename method of the FileSystemObject? GetFilename won't create a path for a file that doesn't exist. What exactly are you trying to do?
    Charlotte

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling Office Get File Name from VBA (Access 2000)

    I have always got best results from the CommonDialog Control. You will need to make a reference to it and place it on your toolbar from the extended tools list. Then drop it onto a form and give it a proper name just like any other control eg dlgOpenFile. then you can reference it in code to call up windows Open, Save, SaveAs, Printer, Font dialogs at will.

  5. #5
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Colorado, USA
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling Office Get File Name from VBA (Access 2000)

    No, I was talking about the adh_accOfficeGetFileNameInfo datatype. It's on page 1140 of the Access 97 Developer's Handbook. It turns out that by setting the second parameter t o the adhOfficeGetFileName function to false, you get the Save dialog and it does exactly what I want. Duh!

    If I had a brain, I'd be dangerous.

    Anyway, thanks for the help.

Posting Permissions

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