save/restore current outline view (collapsed/expanded branches)

H

Henk Koning

Hello,

is there a way (macro?) to save/restore the current outline view of a word
document.

thanks in advance,

Henk Koning
 
J

Jean-Guy Marcil

Henk Koning was telling us:
Henk Koning nous racontait que :
Hello,

is there a way (macro?) to save/restore the current outline view of a
word document.

thanks in advance,

Henk Koning

Not sure what you want to do.
Can you elaborate a bit more?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
H

Henk Koning

Hello Jean-Guy,

when working in outline mode I expand branches and collapse branches as an
ongoing process to have at anytime exactly the information at sight which I
need.
when closing the word document, and continuing for instance the next day,
this information is lost. This means that after re-opening the document I
need to expand/collapse the branche again to arrive at the view when I left
of the day before. I find this anoying. I would like the document to reopen
in the state (view) as it was when I closed it.

Does this explain to you what I mean?

thanks for your attention!

Henk
 
J

Jean-Guy Marcil

Henk Koning was telling us:
Henk Koning nous racontait que :
Hello Jean-Guy,

when working in outline mode I expand branches and collapse branches
as an ongoing process to have at anytime exactly the information at
sight which I need.
when closing the word document, and continuing for instance the next
day, this information is lost. This means that after re-opening the
document I need to expand/collapse the branche again to arrive at the
view when I left of the day before. I find this anoying. I would like
the document to reopen in the state (view) as it was when I closed it.

Does this explain to you what I mean?

Yes, very clearly, unfortunately, I do not know how it can be done, if it
can be done at all.

From VBA you can turn on or off the outline view or expand/shrink a a
particular level... that's about it. I do not think that there are
properties for recording the state of the view.

May be someone will come along with a clever idea..

Sorry, I can't help you with this particular problem.


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
R

Russ

Jean-Guy and Henk Koning,
I think the best you can do is record and store the current state (on or
off) of the toolbar buttons used in Outline view. I'm not that familiar with
toolbar addressing to know how to do that. But it does seem like a
worthwhile macro to have for those people who edit and re-edit the same
document in Outline View.

You must decide when the record-current-Outline-toolbar-button-state macro
is ran. You could have it automatically run whenever a document is closed
from Outline View or manually by starting the macro through a menu, toolbar
button, or shortcut key combination just before closing a document.

Where do you store the button state information?
In current document properties/variables?
In Windows OS Registry?
Etc.

How/when do you restore to toolbar to stored-past state?
Whenever a document is viewed in Outline view?
Whenever a document is opened that has a document variable/property for
outline-view-toolbar-state?
Manually through another menu, toolbar button, or shortcut key combination?
Etc.

You can through VBA use pseudocode like this to change the toolbar buttons
back to stored values:
Sub RestoreToolbarSettings()
ActiveWindow.ActivePane.View.Type = wdOutlineView
ActiveWindow.View.ShowAllHeadings
If documentvariable or windowsregistry has heading1 set then
ActiveWindow.View.ShowHeading 1
End If
End Sub
 
R

Russ

Another useful thing to store with the toolbar settings would be the current
selection or insertion point before closing; and restore or bring that back
into view when the document is re-edited.
 
R

Russ

I afraid I didn't notice until now that the main problem is the expand and
collapse settings and not just the outline level settings. The expand and
collapse settings are more difficult to detect. You'd have to know what
outline ranges are currently visible on screen. I don't know of a way to
detect that through VBA code.
 
R

Russ

Henk Koning,
I just noticed that if you save a document while it is in Outline View,
close it, and reopen the document; then the document **does** reappear just
as you saved it (with things collapsed just like before saving). So is that
all you needed? Just save and close while still in Outline View.
 
R

Russ

Henk Koning,
After more testing, I discovered bug/feature on my Mac 2004 that it only
records the current expand collapse settings when you save it originally or
resave it under a new filename. It might be a feature if you consider being
able to open different versions of the same document that look different
when viewed in Outline View.
Therefore, you may have to save the document while in Outline view, under a
new name, when you want to return to the last expand and collapse view.
 

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