Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jun 2001
    Location
    Illinois
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Macro in Project to Save As (Project 2000 SR1)

    I am trying to make a macro that will save the open project to an ODBC database. I can get it to save fine, but I can't get it to automatically save it as the projects name. I have tried:
    FileSaveAs Name:="<ONTIME_HUSKIE>ActiveProject.FullName"
    and
    FileSaveAs Name:="<ONTIME_HUSKIE>ActiveProject.Name"
    It saves the files as "ActiveProject.FullName" or "ActiveProject.Name."
    How do I get the name to be a variable?

    Thanks,
    Justin K.

  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: VBA Macro in Project to Save As (Project 2000 SR1)

    You've got the object and property in quotes.

    Try...

    FileSaveAs Name : = "<ONTIME_HUSKIE>" & ActiveProject.FullName
    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
    Star Lounger
    Join Date
    Jun 2001
    Location
    Illinois
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Macro in Project to Save As (Project 2000 SR1)

    That worked after some tweaking. I ended up using:
    FileSaveAs Name:="<ONTIME_HUSKIE>" & ActiveProject.Title
    I wanted the tile of the plan to save, not the name, so I guessed it would be .Title. But is there a place in Project or a resource somewhere else that will show me what all the objects are?

    Thanks,
    Justin K.

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

    Re: VBA Macro in Project to Save As (Project 2000 SR1)

    Well, there's the Object Browser. Press F2 in the IDE and see what happends.
    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>

  5. #5
    Star Lounger
    Join Date
    Jun 2001
    Location
    Illinois
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Macro in Project to Save As (Project 2000 SR1)

    My current macro:
    Sub Save_To_ONTIME()
    FileSaveAs Name:="<ONTIME_HUSKIE>" & ActiveProject.Title, UserID:="ontime", DatabasePassWord:="xxx", FormatID:="MSProject.ODBC"
    End Sub

    It fairly simple and works well, but I'm having a problem with Project adding .mpp to the end of the ActiveProject.Title seemingly at random. This causes problems with getting 2 of the same project into my database.
    Currently my macro saves the plan, and if it is already there it asks me if I want to overwrite or not, which is good. What I would like to add is if the project is not already in the database, it would ask if I would like to create a new project in the database.

    Thanks,
    Justin K.

Posting Permissions

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