How to determine property of a project?

S

SigR

I would like to have a macro that toggles summary tasks display.
Basically my logic is:

Dim Show as Boolean
Show = 'current state of project display'
Show = Not (Show)
SummaryTasksShow (Show)

My problem is determining the current state.
I have found a property "ShowSummary" that is Boolean and Read/Write. It
applies to a "Group Object" or Groups Collection Object". Whatever that
means.

I have tried the (to me) obvious:
Show = ActiveProject.ShowSummary
and a few variations thereof. Without success.

How do you code that second line?

Thank you,
SigR
New to VBA :-(
 
J

John

SigR said:
I would like to have a macro that toggles summary tasks display.
Basically my logic is:

Dim Show as Boolean
Show = 'current state of project display'
Show = Not (Show)
SummaryTasksShow (Show)

My problem is determining the current state.
I have found a property "ShowSummary" that is Boolean and Read/Write. It
applies to a "Group Object" or Groups Collection Object". Whatever that
means.

I have tried the (to me) obvious:
Show = ActiveProject.ShowSummary
and a few variations thereof. Without success.

How do you code that second line?

Thank you,
SigR
New to VBA :-(

SigR,
Most of Project's view characteristics cannot be "read". For example,
there is no way to directly tell via VBA whether a font color is black
or red. Or in your case, there is no direct way to tell using VBA
whether or not summary lines are displayed. That's just the nature of
Project's object library.

The ShowSummary Property that you found is simply an option that can be
applied when grouping. It is the VBA equivalent of checking the "show
summary tasks" option in the lower left corner of the customize group by
window.

Your lead in statement says you want to toggle display of summary tasks.
Whether or not summary lines are displayed is controlled by the
ViewOptions Method. Displaying summary tasks is one of many options for
that method.

Mind if I ask why you want to toggle the display of summary lines? It
doesn't sound like a very useful action to me.

John
Project MVP
 
S

SigR

I have been switching on and off using the ViewOptions panel, Wanted to do it
more easily.

I am building a medium (500 tasks) project. I have all (knock wood) the
tasks enetered and am adding resources and durations. I have a filter for
unassigned tasks and can also filter 1-day tasks. I use these to see where I
have yet to enter data. These views are better without the summary tasks, but
I often have to switch the summary tasks on to see the task in relation to
its hierarchy.

SigR
 
J

John

SigR said:
I have been switching on and off using the ViewOptions panel, Wanted to do it
more easily.

I am building a medium (500 tasks) project. I have all (knock wood) the
tasks enetered and am adding resources and durations. I have a filter for
unassigned tasks and can also filter 1-day tasks. I use these to see where I
have yet to enter data. These views are better without the summary tasks, but
I often have to switch the summary tasks on to see the task in relation to
its hierarchy.

SigR
SigR,
Why not add Summary = false to your filters?

John
Project MVP
 
S

SigR

Yes, I could. Will!
Truth is I'm keyboard oriented and don't like using the mouse when I'm doing
a lot of data entry.

Thanks for the suggestion.

SigR
 
S

SigR

On second thought, I'll make two macros. One turn on, the second off.

Again, thanks.
SigR
 
J

John

SigR said:
On second thought, I'll make two macros. One turn on, the second off.

Again, thanks.
SigR

SigR,
You're welcome and thanks for the feedback.

John
 
D

Dean C

This is eight months late, but in case you are still interested, the command
that you found: SummaryTasksShow performs a toggle action. Look at the
definition for (Show).
Syntax
expression .SummaryTasksShow(Show)
Show Optional Boolean. True if summary tasks display in the active view.
The default value is True if summary tasks are hidden and False if they are
visible.

Assign the command to a button to toggle on and off the display of summary
tasks.
 

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