none
Automated CSV Export RRS feed

  • Question

  • Hi, hope somebody can help! I am using .csv versions of my project files to populate .html based dashboards that I have created, I would like to try and automate the creation of the .csv file and potentially embed it into the default file,save, command so that on every save of the .mpp a .csv version is also created in the location where the .mpp was opened from. Any ideas David
    Monday, August 22, 2011 2:21 PM

Answers

  • David,

    I assume you are using the Save As to the .csv format, although it's not to difficult to create your own comma delimited text file of Project data with VBA. You won't be able to modify the default Save command but you can record a macro while saving to .csv and then incorporate that macro into an Event macro that fires on or before the save event.

    This is what your code might look like, assuming you already have a map to define your export fields:

     

    Private Sub Project_BeforeSave(ByVal pj As Project)

    FileSaveAs Name:="C:\Users\John\Documents\csvTest.csv", FormatID:="MSProject.CSV", _

        Map:="cvsSave"

    End Sub

     

    To integrate this macro into your file do the following:

    1. From the ribbon go to Developer/Visual Basic icon

    2. In the VB Editor window, click the icon to display the Project Explorer

    3. Double click on ThisProject under the VBAProject hierarchy. That will open the edit window on the right

    4. Copy and paste the above code into the edit window

    5. Modify the FileSaveAs parameters as necessary for your situation

    Now when you save your project, the event will fire and the csv will automatically be generated.

    John

    Monday, August 22, 2011 3:06 PM

All replies

  • Not sure if it can be done, but still try posting it on the MS Project Customization Forum, may be someone could suggest a Macro for it :

    http://social.microsoft.com/Forums/en-US/project2010custprog/threads


    Sapna S
    Monday, August 22, 2011 2:26 PM
    Moderator
  • David,

    I assume you are using the Save As to the .csv format, although it's not to difficult to create your own comma delimited text file of Project data with VBA. You won't be able to modify the default Save command but you can record a macro while saving to .csv and then incorporate that macro into an Event macro that fires on or before the save event.

    This is what your code might look like, assuming you already have a map to define your export fields:

     

    Private Sub Project_BeforeSave(ByVal pj As Project)

    FileSaveAs Name:="C:\Users\John\Documents\csvTest.csv", FormatID:="MSProject.CSV", _

        Map:="cvsSave"

    End Sub

     

    To integrate this macro into your file do the following:

    1. From the ribbon go to Developer/Visual Basic icon

    2. In the VB Editor window, click the icon to display the Project Explorer

    3. Double click on ThisProject under the VBAProject hierarchy. That will open the edit window on the right

    4. Copy and paste the above code into the edit window

    5. Modify the FileSaveAs parameters as necessary for your situation

    Now when you save your project, the event will fire and the csv will automatically be generated.

    John

    Monday, August 22, 2011 3:06 PM