none
Delete all Columns and Add new columns and custom attributes (VBA) RRS feed

  • Question

  • Hi,
    I have a project file which is used as a template in which the columns start as Text5,Task Name,Text 4,Start,Finish and so on

    But users often change the arrangement of the columns and add some new columns.I thought of adding a "Reset Columns" buttons but its not as effective as I thought.Is there a better way to set the columns through a VBA script.

    Whenever I press the button the column headers has to set to default values like Text5,Task Name,Text 4,Start,Finish ....

    Any help???

    Thanks!

    Friday, August 28, 2015 6:52 AM

Answers

  • becks23,

    Take a look at the TableEdit or TabelEditEx Methods, whichever is appropriate. That will give you what you want.

    Another option might be to create your custom table and save it to your Global. Then if a user changes the format of the custom table in the file, you can replace the table in the file with the saved table in your Global. Perhaps this could be run automatically on an Open event.

    Some thoughts.

    John

    • Marked as answer by becks23 Monday, August 31, 2015 6:27 AM
    Friday, August 28, 2015 4:28 PM

All replies

  • A VBA method to create table definitions in Ms Project.

    As we see in the section View > Tables > More Tables

    Praveen.

    Friday, August 28, 2015 12:09 PM
  • becks23,

    Take a look at the TableEdit or TabelEditEx Methods, whichever is appropriate. That will give you what you want.

    Another option might be to create your custom table and save it to your Global. Then if a user changes the format of the custom table in the file, you can replace the table in the file with the saved table in your Global. Perhaps this could be run automatically on an Open event.

    Some thoughts.

    John

    • Marked as answer by becks23 Monday, August 31, 2015 6:27 AM
    Friday, August 28, 2015 4:28 PM
  • Thanks John,

    I did the same...The TableEditEx method.

    By recording the macro when doing this 

    View > Tables > More Tables and by defining a table.

    Becks23.

    Monday, August 31, 2015 6:27 AM
  • Becks23,

    You're welcome and thanks for the feedback.

    I assume you used the recorded macro simply as a template and that you re-wrote the code for background processing as that runs faster than the foreground processing code produced with the recorder.

    John

    Tuesday, September 1, 2015 3:56 PM