Count project columns

R

Rod

Can someone show me the code that would be used to count the number of
columns in a project file?

I do the following the get the number of tasks for the project:

ActiveProject.NumberOfTasks

But I don't see anything that would give me the number of columns.

Thanks,
Rod
 
J

Jan De Messemaeker

Hi,

The number of visible columns is not a property of a project, since every
view can have a number of different tables.
This will give you the number of fields in the currently visibletabel (if
the view is a task view)

activeproject.TaskTables(activeproject.Currenttable).tablefields.Count

Hope this helps
 
R

Rod

View: Webex View
Table: Print Table

I'm not sure if these are custom or default for MS Project.
 
J

Jan De Messemaeker

This is what the help says:

TaskTables Property
See AlsoApplies ToExampleSpecifics
Returns a Tables collection representing the task tables of a project.
Read-only.



So sorry, WE DO have it.

Hope this helps
 
J

Jan De Messemaeker

They aren't but that is irrelevant since I refer to the table visible at
that point in time (CurrentTable)
 
J

Jan De Messemaeker

Hi,

Sorry about that, it's long ago I had a question on 2000 - and I put my
computer running it in the attic.
I'll have a look whether there is no other solution.
Greetings,
 
J

Jan De Messemaeker

Hi,

What about

Selectall
count=activeselection.fieldidlist.count

(Verified the existence in 2000 :))

Greetings
 
R

Rod

Looks like that is the direction I need to go. My only issue: I have 11
columns showing and "count" is showing 13. I'm trying to determine what
fields it is counting.

Thanks Jan.

You're a big help.
 
J

Jan De Messemaeker

Hi,

Lok at the table through View, Table...,Edit, there probably are two columns
with 0 width.

Hope this helps,

Jan
 

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