Restore original View after OutlineShowAllTasks

S

SpaceCamel

While it is best the use background processing using the task object, some
functions only work on the visual row. But when using SelectRow you get the
problem of collapsed summaries throwing off the task number. To get around
that you can use OutlineShowAllTasks. But I would like to restore the
original view with collapsed summaries after processing.

I tried but the original view is not restoring. It remains expanded. And I
have tried creating a new view with ViewEditSingle. What am I doing wrong?

I am saveing the current view with:
currView = myProj.CurrentView

then restore with:
myProj.Views(currView).Apply
 
J

Jan De Messemaeker

HI,
Applying a view activates the filter that goes with it (see View, More
Views, Edit).
From the top of my hat I'd say before expanding select all, for each task in
activeselection.tasks set Flag1 (or any) to yes, then after expanding apply
a filter flag1=Yes.
Hope this helps,

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
S

SpaceCamel

I am not using any filters, just some of the summary sections are collapsed.
And I want to restore the original state.
Views do maintain the state of summaries. I am just not sure how to manage
them in VBA.
 
J

John

SpaceCamel said:
I am not using any filters, just some of the summary sections are collapsed.
And I want to restore the original state.
Views do maintain the state of summaries. I am just not sure how to manage
them in VBA.

SpaceCamel,
I'm not sure why you reposted - I guess you didn't like my answer. At
any rate, Jan provided another method for restoring a collapsed view. By
using ActiveSelection.Tasks to set a spare flag, you are effectively
identifying only those tasks that appear in the collapsed view. Then by
creating a filter to look for that flag, (after you've finished tweaking
the font characteristics), you will have the original view. Jan's method
is a little easier than what I mentioned (i.e. using OutlineHide), but
be aware that it will leave the flag field set unless you clear it
before saving.

John
Project MVP
 
S

SpaceCamel

Sorry John, I didn't see your reply when I posted this one, I figured my
question had dropped off the radar.

OK, I assumed that the state of the summary tasks was stored in the view.
Guess not. So where is it stored? I thould there was going to be a simple
solution.

Thanks,
 
S

SpaceCamel

Since there didn't seem to be a way to directly determine the state of
summary task , I did it this way:

Loop to Mark the summary tasks that are collapsed in the current view.
Expand all tasks
-Do the processing
Loop to Re-collapse the summary tasks that were Marked

It works!
================================
 
J

John

SpaceCamel said:
Since there didn't seem to be a way to directly determine the state of
summary task , I did it this way:

Loop to Mark the summary tasks that are collapsed in the current view.
Expand all tasks
-Do the processing
Loop to Re-collapse the summary tasks that were Marked

It works!
================================

SpaceCamel,
Great! I'm glad you got it working.

By the way, the state of the summary tasks is stored with the view. But
when you save the current view in a variable, that variable is changed
when the current view is modified (e.g. expanded hierarchy).

John
Project MVP
 

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