Hi
I have discovered that the behavior of macros is different when
Application.Visible = True and it is False.
I observed some problems when running the macro. I turned the
Application.Visible = True, debugged the code, corrected the errors, ran
some tests without debug, but still with Application.Visible = True.
As soon I changed Application.Visible = False, the resulting document, the
macro generated looked different.
How can I see follow thr progress in the document, as I step through
statements without having Application.Visible = True?
Are there some spicific behavior, that is different when Application.Visible
= True and Application.Visible = False (exept that the document is/is not
visible)?
In my examble I want the next page to have a new set of headers.
Standing at end of the document (end of page x) I use the following code:
Selection.InsertBreak Type:=wdSectionBreakNextPage
' Cut link between herder/footer on page x and page x+1
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.LinkToPrevious = False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
' Delete all contense in herder of page x+1
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.WholeStory
Selection.Delete Unit:=wdCharacter, Count:=1
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
When Application.Visible = True, I have headers on page x and no headers on
page x+1.
When Application.Visible = False, I have No headers on page x and no headers
on page x+1.
It looks like there is a difference in what header/footer I am standing in
after inserting a SectionBreakNextPage and then doing a
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader.
Ebbe
Word Heretic - 20 Jun 2005 04:19 GMT
G'day Ebbe,
You are using the wrong objects. Dont use Selection and ActiveWindow,
deal with objects direct
Eg
ActiveDocument.Storyranges(whatever).Sections(n)
When Vis is off, there is no 'selection' per se so you get problems.
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Ebbe reckoned:
>Hi
>
[quoted text clipped - 41 lines]
>
>Ebbe
Ebbe - 20 Jun 2005 22:31 GMT
Hi Steve
OK
It looks like that I am not able to use Macro recorder to help me in this
case, because it works upon the ActiveVindow in stead of ActiveDocument :-(
Is it possible for you to give me some more details of what you mean about
"ActiveDocument.Storyranges(whatever).Sections(n)"?
I am not experienced in working with header/footer in VBA.
When I am positioned at the end of the document, and I will introduce a new
page with a different header/footer.
How do I transcript my code to use ActiveDocument in stead of ActiveVindow ?
Ebbe
> G'day Ebbe,
>
[quoted text clipped - 62 lines]
>>
>>Ebbe
Word Heretic - 24 Jun 2005 04:05 GMT
G'day "Ebbe",
Load up Word, open the VBE (Alt+F11) and open the Object Browser (F2).
Select Document. Examine its children. Then examine the children of
those children. By doing this you will gain an understanding of the
Document Object Model (DOM).
If you are unsure of something like Storyranges(whatever), look up
storyranges in the help system for an explanation.
Steve Hudson - Word Heretic
steve from wordheretic.com (Email replies require payment)
Without prejudice
Ebbe reckoned:
>Hi Steve
>
[quoted text clipped - 78 lines]
>>>
>>>Ebbe