Section Break Questions: Round #2

B

Brendan

This was asked in another post of mine but I am still not getting a results.

Summary: 2 page document with two continuous section breaks. One located at
the bottom of page 1 and the other at the bottom of page 2. AutoNew macro
which protects page 1 and leaves page 2 unprotected (works fine). Page 1 is
a large table with form fields. Page 2 contains a bookmark where the
narrative will start. The last form field on Page 1 contains an on exit
macro to go to the bookmark on page 2.

Goal #1: To get the cursor from the last form field on page 1 to the
narrative bookmark on page 2.
Goal #2: Leave Page 1 protected via the section break and page 2 unprotected
just as the document opened via the AutoNew macro.

Issues: Using numerous variations of the below code, the only thing that
happens is the cursor does actually exit the last form field (via the exit
macro) but only goes to the bottom of page 1 at the section break and never
makes it to the bookmark. The section then shows as being unprotected.

ActiveDocument.Unprotect
ActiveDocument.Sections(1).ProtectedForForms = False
If ActiveDocument.Bookmarks.Exists("swPropNarr") Then
ActiveDocument.Bookmarks("swPropNarr").Select
End If

FYI: If I run the macro while the document is unprotected, it works perfect.

Conclusion: It almost seems that the macro is running too fast for the
document to unprotect itself prior to going to the the bookmark.
 
J

Jean-Guy Marcil

Brendan was telling us:
Brendan nous racontait que :
This was asked in another post of mine but I am still not getting a
results.

It seems to me that you are not reading carefully what is being posted.
Or possibly I do not really grasp the problem you are facing.

Yesterday, I posted two replies to your second post on the topic. You
actually replied to one of them, and then proceeded with a new post on the
same topic (the third thread in all that you have started on the same
topic...)

For the third time, you do not need this in your code:

ActiveDocument.Sections(1).ProtectedForForms = False

For the rest, see my third reply in your second thread on the topic.

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

Brendan

I am not here to split hairs but your last post at 8/16/2006 1:15 PM PST was
"show us your code" to which I replied at 8/16/2006 1:36 PM PST. That was my
second respons to your second post. So, the, "Yesterday, I posted two
replies to your second post on the topic. You actually replied to one of
them" is an invalid statement as the time stamp clearly shows that it took me
21 minutes to respond to your second post and that was the last I heard from
anybody.

So I figured I would post a real clear summary of what I was trying to do.
Several responded with simply the "ActiveDocument.unproted" and all will be
fine. However, there is someone else who posted the exact same question as
mine and never got an answer.

The workable solution that someone provides will definitely benefit numerous
Word Users so as not to have to create UserForms to accomplish what should be
a simple task based on VBA code.
 
J

Jean-Guy Marcil

Brendan was telling us:
Brendan nous racontait que :
I am not here to split hairs but your last post at 8/16/2006 1:15 PM
PST was "show us your code" to which I replied at 8/16/2006 1:36 PM
PST. That was my second respons to your second post. So, the,
"Yesterday, I posted two replies to your second post on the topic.
You actually replied to one of them" is an invalid statement as the
time stamp clearly shows that it took me 21 minutes to respond to
your second post and that was the last I heard from anybody.

So I figured I would post a real clear summary of what I was trying
to do. Several responded with simply the "ActiveDocument.unproted"
and all will be fine. However, there is someone else who posted the
exact same question as mine and never got an answer.

The workable solution that someone provides will definitely benefit
numerous Word Users so as not to have to create UserForms to
accomplish what should be a simple task based on VBA code.

I am glad that I was able to help, albeit in another thread.

Never mind the "hair splitting". Like you, I hope as many people as possible
will benefit form the exchanges we have in the NG. So, all I wanted to do
was to point out that starting numerous threads on the same topic just adds
unnecessary traffic and actually makes it more difficult for people to
follow up and to search. For example, this thread is now dead as the answer
to your problem lies elsewhere. So anybody finding this will see a dead end.
For those people, I will paste the content of the last two posts from the
other thread here:

My reply:
______________________________________
As I wrote in my other reply in this thread, if you set up your template
properly, all you need is
ActiveDocument.Unprotect

Now, in your code, you are unprotecting the document.
May I ask why?
Also, you are not re-protecting it, so of course, section 1 is now
unprotected.

I have the feeling that all you want to do is send the user to the beginning
of the editable part of the document when they are done typing in the
formfields. If this is the case, then you do not need a macro.
Just protect section 1 (and not section 2) and then the cursor will
automatically go to the beginning of section 2 when they tab out of the last
field in section 1.

Now, if you really need a macro, try this:

Sub macGoToBMPropNarr()
Application.OnTime When:=Now, Name:="ReallymacGoToBMPropNarr"
End Sub

Sub ReallymacGoToBMPropNarr()
If ActiveDocument.Bookmarks.Exists("swPropNarr") Then
ActiveDocument.Bookmarks("swPropNarr").Select
End If
End Sub

It seems that without the macro to call another macro, Word will not
properly get to the bookmark.
_______________________________________

Yours:
_______________________________________
That worked perfectly. Thank you very much. I can now leave the document
protected with Section(2) unprotected. I don't know why Word did not like
simply executing the "ReallymacGoToBMPropNarr()" on its own.
_______________________________________

My final thought:

Do you really need VBA for this? Is the bookmark deep in section two or
right near the top of page 2? If the latter, VBA is not really necessary,
unless you have user that easily mess things up!

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

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