How to insert/show a column from Add-In

M

Michael Agee

Is there a way to show a project column programmatically? I don't mean to
launch the Column Definition dialog with which the user has to then interact.
I want to cause a column I wish to insert to appear without user interaction.
I have been through the Developer Reference and I can't seem to find a method
that accomplishes this.

Thanks
 
J

Jack Dahlgren

This code inserts the "indicators" column as the second column in the
"Entry" table. Modify as required for your use.

TableEdit Name:="Entry", TaskTable:=True, NewName:="", FieldName:="",
NewFieldName:="Indicators", Title:="", Width:=10, Align:=2,
ShowInMenu:=True, LockFirstColumn:=True, DateFormat:=255, RowHeight:=1,
ColumnPosition:=2, AlignTitle:=1

-Jack Dahlgren
 
R

Rod Gill

Yes. I recommend that if your macro needs a particular set of columns you
create a new table programmatically and apply it with a new View as well.

To see the code needed for creating and applying tables and Views, record a
macro of you manually creating a table and View then applying them. (Tools,
Macro, Record new macro).

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 
M

Mike

Jack:
Jack:

That did it, thanks - in c# I did


Application.TableEdit("Entry",true,missing,missing,missing,"Number11","Cost
Element",missing,Microsoft.Office.Interop.MSProject.PjAlignment.pjCenter,
true,true,missing,missing, missing,4,missing,missing,missing);
Application.TableApply("Entry");
 
M

Mike

Application.TableEdit("Entry", true, missing, missing, missing,
"Number11", "Cost Element", missing, 15,
Microsoft.Office.Interop.MSProject.PjAlignment.pjCenter,
true, missing, missing, missing, 4,
missing, missing, missing);
Application.TableApply("Entry");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top