Отвечено Opening a File Selection window from VBA

  • Monday, May 07, 2012 8:21 PM
     
     

    I am working on a vba sub-routine that will create a project file that we can send to our customers.  The procedure will remove any confidenital information from the plan and save it a local file. 

    I would like the user to select the destination using a standard windows file selection window. 

    How can i do that?

    Is there a function I can call?  Do I need to create a form?

    Thanks in advance for your help,

    Craig


    Thanks, Craig

All Replies

  • Monday, May 07, 2012 8:53 PM
    Moderator
     
     
    Application.FileSaveAs  on its own (no parameters) opens the save as dialog. As a training issue, get users to set the default folder for save under Options. That avoids lots of folder navigation!

    Rod Gill

    The one and only Project VBA Book

    Rod Gill Project Management

  • Monday, May 07, 2012 9:07 PM
     
     

    Rod:

    Thanks for the fast reply but that does not work exactly the way I want it to.

    The problem is that the users I be connected to project server.  When I execute the application.FileSaveAs function the "Project Server Save as" dialog box opens, not a file selection window.  The user would have to click 'Save to file, which will confuse them.


    Thanks, Craig

  • Tuesday, May 08, 2012 2:36 AM
    Moderator
     
     Answered

    This is the simplest solution (with a training component). To get a file save as local file dialog you will need to use a windows API. Try the following code:

    http://access.mvps.org/access/api/api0001.htm

    It's for Access, but does work in Project.


    Rod Gill

    The one and only Project VBA Book

    Rod Gill Project Management

    • Marked As Answer by CraigS99 Tuesday, May 08, 2012 1:23 PM
    •  
  • Tuesday, May 08, 2012 1:25 PM
     
     

    Rod:

    I add to make a couple minor changes (I suspect because the code is old), but it worked perfectly

    Thanks!


    Thanks, Craig