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

    VBA Macros (Project 2000 SR1)

    Hi,

    I'm new to writing VBA Macros for MS products, so I'm starting simple.
    My first Macro is a simple macro that will save as my projects to a database. So far I have:

    Sub Save_To_Database()
    ' Macro Save_To_Database
    ' Macro Recorded Tue 5/21/02 by justin.
    FileSaveAs Name:="<Database>TITLE_OF_PROEJECT", UserID:="xxxxxxx", DatabasePassWord:="xxxxxx", FormatID:="MSProject.ODBC"
    End Sub

    It works fine, except I would like TITLE_OF_PROEJECT to be the title of the project. How do I find the name of the object to be inserted, or whatever needs to be inserted? Is there a good resource to find these things out?

    Thanks,
    Justin

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: VBA Macros (Project 2000 SR1)

    Could you please clarify when you indicate you are saving your project to a database. For example, are you trying to create an MS Access Database, Project Database or other. I see you are also using ODBC. If you are trying to create an MS Access Database or Project Database, then ODBC is not required. In either event, the following example shows how to save the project as a template file with the active project (or current) project name. You can modify this as necessary or hopefully, this will give you some ideas.

    Sub Save_To_Database()
    Dim prjApp As MSProject.Application
    Dim prjProject As MSProject.Project

    Set prjApp = CreateObject("Msproject.Application")
    prjApp.FileSaveAs prjApp.ActiveProject.Name, pjMPT

    Set prjProject = Nothing
    Set prjApp = Nothing

    End Sub
    Regards,

    Gary
    (It's been a while!)

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

    Re: VBA Macros (Project 2000 SR1)

    We currently have a web front end for an Oracle database that is just the project plans. People log into the web front end, and enter their actual hours into it. I then log into it, take those hours, and put them into the plans. It is basically a simplified version of Project Central, which we used to use. The reason we stopped using it is because of the problem with actual hours getting distributed, like I posted in my other thread, which is also still happening.

    These plans change a lot, resources come and go, the project manages just have to change their tasks around, so once a week I have to upload the plans to this oracle database. So I click save as, ODBC, Machine Data Source, the Data Source Name I want, and then OK. I didn't want to do all that clicking, so I had Project Record me doing it once, which is what gave me my previous code. It worked great, except project used the Title for the plan I recorded the macro on for the rest of the plans I saved. So i need to know how to tell the macro to insert the plans title as the Save As name.

    Justin K.

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: VBA Macros (Project 2000 SR1)

    I understand what you are trying to do, however, can't get the name of the project to insert automatically. I may have also posted a similar question in the past in the access forum. I will reply once again if I figure it out.

    Anyone else have any ideas??
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

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