re-select a bookmark on exit in protected document

  • Thread starter OTWarrior via OfficeKB.com
  • Start date
O

OTWarrior via OfficeKB.com

I have a protected document that uses drop down form fields, and on exit I
want the form field to be reselected if a certain value is selected.

I am using this code for another area to get the name, but i haven't been
able to use it as a selection


If Selection.FormFields.Count = 1 Then 'No textbox but a check- or listbox
BKMname2 = Selection.FormFields(1).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
BKMname2 = Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If

I have tried:

ActiveDocument.FormFields(BKMname2).Range.Select

Selection.GoTo What:=wdGoToBookmark, Name:=BKMname2

ActiveDocument.Bookmarks(BKMname2).Range.Fields(1).Result.Select

...And none of these seem to select the bookmark.

What am I doing wrong?
 
D

Doug Robbins - Word MVP

You would need to have the code in a macro that runs on entry to the next
formfield and the movement of the focus to that formfield will need to
result from the use of the tab key, not the mouse. You will also need to
use a bit of a kludge as follows to be able to select something from the
dropdown

'this code to be run on entry to the next formfield
ActiveDocument.FormFields("DropDown1").Range.Select
Application.OnTime When:=Now + TimeValue("00:00:01"), _
Name:="Dropdown"

End Sub
Sub Dropdown()
SendKeys "%{down}"
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
O

OTWarrior via OfficeKB.com

I can make it reselect the drop down menu when tab is pressed, that is not a
problme as i simply use:
SendKeys "{LEFT}"
SendKeys "%{DOWN}"

however the people using this form may not always use the tab key, or at all,
and i just want to cover myself, otherwise I will be bombarded by calls.

And what is the TimeValue required for?

(the code normally runs on exit, as that is when I check the value of the
dropdown box, and I am trying to keep the ammount of macros down to a minimum)

You would need to have the code in a macro that runs on entry to the next
formfield and the movement of the focus to that formfield will need to
result from the use of the tab key, not the mouse. You will also need to
use a bit of a kludge as follows to be able to select something from the
dropdown

'this code to be run on entry to the next formfield
ActiveDocument.FormFields("DropDown1").Range.Select
Application.OnTime When:=Now + TimeValue("00:00:01"), _
Name:="Dropdown"

End Sub
Sub Dropdown()
SendKeys "%{down}"
End Sub
I have a protected document that uses drop down form fields, and on exit I
want the form field to be reselected if a certain value is selected.
[quoted text clipped - 21 lines]
What am I doing wrong?
 
O

OTWarrior via OfficeKB.com

NB: also meant to say the users may not always select the box after, but may
select elsewhere on the document.
 
D

Doug Robbins - Word MVP

Impatience will get you nowhere.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
O

OTWarrior via OfficeKB.com

Doug said:
Impatience will get you nowhere.

Considering only the listings on the first page get a response on this forum,
I do not see a problem with bumping.
 
D

Doug Robbins - Word MVP

What you fail to realise is that most of the people that provide assistance
in these forums do not use the same interface as that which you must be
using by your reference to pages.

The other thing that you need to realise is that there are somethings that
Word cannot be made to do.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
O

OTWarrior via OfficeKB.com

Doug said:
What you fail to realise is that most of the people that provide assistance
in these forums do not use the same interface as that which you must be
using by your reference to pages.

The other thing that you need to realise is that there are somethings that
Word cannot be made to do.

How can people change the look of the forum? as I would love to to change
OfficeKB to look more like VBA express's site.

Also, are you telling me that word cannot go to a specific bookmark in VBA?
Even though I can reference the same bookmark on exit and clear it's list,
and rebuild it? I can make the code think I press the left key to go back,
and I can specifically choose any other bookmark to go to, but I need to
figure out how to go back to the one I just came from.

I was also told that the only way to get around the 25 limit on drop down
form fields was to use a User form. Well...that is incorrect as I found a way
around it (there is still the 25 limit, but I thought outside of the limition)
 
D

Doug Robbins - Word MVP

Use an NNTP newsreader and connect directly to the msnews.microsoft.com news
servers rather than through OfficeKB whatever that is.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
O

OTWarrior via OfficeKB.com

Doug said:
Use an NNTP newsreader and connect directly to the msnews.microsoft.com news
servers rather than through OfficeKB whatever that is.

What is an NNTP newsreader? do I have to intall it or is it web based? Is it
similar to RSS feeds?
 
D

Doug Robbins - Word MVP

Outlook Express is an NNTP newsreader. Here are instructions for how to use
it to connect to the newsgroups:

1.1. Connect to a newsgroup server using Outlook Express
Open Outlook Express and follow these steps:

1.. On the Tools menu, click Accounts.
2.. In the Internet Account dialog box, click Add, and then click News.
The Internet Connection Wizard starts. Follow these steps in the wizard:
1.. On the first screen, in the Display name box, type the name that
other users will see when you post a message to the newsgroup, and then
click Next.
2.. On the second screen, type your full e-mail address in the E-mail
address box, and then click Next.
3.. On the third screen, in the News (NNTP) Server box, type the name of
your news server. To subscribe to the newsgroups hosted on Microsoft's
servers, type msnews.microsoft.com. If you don't know the name of your news
server, contact your Internet provider.
4.. If necessary, select the My news server requires me to log on check
box, and then click Next. If you don't know whether your server requires you
to log on, contact your Internet provider. The Microsoft server does not
require a user name and password.
5.. On the last screen, click Finish.
3.. Click Close, and then click Yes when asked if you want to download
newsgroups from the account you just created. The Newsgroup Subscriptions
dialog box appears.
4.. Select the newsgroups you want to use, click Subscribe, and then click
OK.

Note Most of Microsoft newsgroups use this naming convention:
microsoft.public.application_name.specific_area. For example: you could
subscribe to microsoft.public.office.dataanalyzer, or
microsoft.public.excel.programming. However, that isn't always the case.
Don't be afraid to browse the list of groups in order to find something that
you think will be useful.

5.. On the Tools menu, click Options, click the Read tab, and then clear
the Get 300 headers at a time check box.
6.. Click the Maintenance tab, clear the Delete new messages n days after
being downloaded check box, and then click OK.
Step 5 allows you to download and read all the newsgroup's postings when you
first subscribe. Step 6 allows you to read older messages.

1.2. Subscribe or unsubscribe to newsgroups
After you establish a connection to your newsgroup server, you add
newsgroups to your list by subscribing. You can subscribe or unsubscribe to
newsgroups at any time. Typically, you use the group name as a guide when
subscribing. For example, a name such as
microsoft.public.office.developer.outlook.forms would be a good place to
start if you need help writing a custom form for Outlook.

To subscribe

1.. Start Outlook Express.
2.. In the folder pane, click the name of your news server. For example,
if you established a connection to Microsoft's server, click
msnews.microsoft.com.
3.. In the main viewing pane, click Newsgroups.
4.. In the Newsgroup Subscriptions dialog box, select a newsgroup from the
list, and then click Subscribe.
5.. Repeat the previous step to subscribe to additional newsgroups, and
then click OK when you finish.
6.. In the main viewing pane, double-click the name of the new newsgroup.
If you only want to receive new messages since the last time you visited,
select the New messages only check box, and then double-click the newsgroup
name.

Note When you subscribe to a newsgroup for the first time, you receive
all the messages whether or not you select the New messages only check box.
To unsubscribe

a.. In the Outlook Express folder pane, right-click the newsgroup that you
want to stop using, and then click Unsubscribe on the shortcut menu.
Tips

a.. To reduce the number of items in the list of available newsgroups,
enter a phrase in the Display newsgroups which contain box. For instance,
you can enter an application name such as "publisher" or the name of a
discipline such as "programming." The list changes automatically when you
finish typing.
b.. Newsgroups in languages other than English are identified by their
names; for example, microsoft.public.fr.excel is a newsgroup for Microsoft
Excel users who speak French.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
O

OTWarrior via OfficeKB.com

Thank you, I will give that a try when I get home.
Outlook Express is an NNTP newsreader. Here are instructions for how to use
it to connect to the newsgroups:

1.1. Connect to a newsgroup server using Outlook Express
Open Outlook Express and follow these steps:

1.. On the Tools menu, click Accounts.
2.. In the Internet Account dialog box, click Add, and then click News.
The Internet Connection Wizard starts. Follow these steps in the wizard:
1.. On the first screen, in the Display name box, type the name that
other users will see when you post a message to the newsgroup, and then
click Next.
2.. On the second screen, type your full e-mail address in the E-mail
address box, and then click Next.
3.. On the third screen, in the News (NNTP) Server box, type the name of
your news server. To subscribe to the newsgroups hosted on Microsoft's
servers, type msnews.microsoft.com. If you don't know the name of your news
server, contact your Internet provider.
4.. If necessary, select the My news server requires me to log on check
box, and then click Next. If you don't know whether your server requires you
to log on, contact your Internet provider. The Microsoft server does not
require a user name and password.
5.. On the last screen, click Finish.
3.. Click Close, and then click Yes when asked if you want to download
newsgroups from the account you just created. The Newsgroup Subscriptions
dialog box appears.
4.. Select the newsgroups you want to use, click Subscribe, and then click
OK.

Note Most of Microsoft newsgroups use this naming convention:
microsoft.public.application_name.specific_area. For example: you could
subscribe to microsoft.public.office.dataanalyzer, or
microsoft.public.excel.programming. However, that isn't always the case.
Don't be afraid to browse the list of groups in order to find something that
you think will be useful.

5.. On the Tools menu, click Options, click the Read tab, and then clear
the Get 300 headers at a time check box.
6.. Click the Maintenance tab, clear the Delete new messages n days after
being downloaded check box, and then click OK.
Step 5 allows you to download and read all the newsgroup's postings when you
first subscribe. Step 6 allows you to read older messages.

1.2. Subscribe or unsubscribe to newsgroups
After you establish a connection to your newsgroup server, you add
newsgroups to your list by subscribing. You can subscribe or unsubscribe to
newsgroups at any time. Typically, you use the group name as a guide when
subscribing. For example, a name such as
microsoft.public.office.developer.outlook.forms would be a good place to
start if you need help writing a custom form for Outlook.

To subscribe

1.. Start Outlook Express.
2.. In the folder pane, click the name of your news server. For example,
if you established a connection to Microsoft's server, click
msnews.microsoft.com.
3.. In the main viewing pane, click Newsgroups.
4.. In the Newsgroup Subscriptions dialog box, select a newsgroup from the
list, and then click Subscribe.
5.. Repeat the previous step to subscribe to additional newsgroups, and
then click OK when you finish.
6.. In the main viewing pane, double-click the name of the new newsgroup.
If you only want to receive new messages since the last time you visited,
select the New messages only check box, and then double-click the newsgroup
name.

Note When you subscribe to a newsgroup for the first time, you receive
all the messages whether or not you select the New messages only check box.
To unsubscribe

a.. In the Outlook Express folder pane, right-click the newsgroup that you
want to stop using, and then click Unsubscribe on the shortcut menu.
Tips

a.. To reduce the number of items in the list of available newsgroups,
enter a phrase in the Display newsgroups which contain box. For instance,
you can enter an application name such as "publisher" or the name of a
discipline such as "programming." The list changes automatically when you
finish typing.
b.. Newsgroups in languages other than English are identified by their
names; for example, microsoft.public.fr.excel is a newsgroup for Microsoft
Excel users who speak French.
[quoted text clipped - 3 lines]
it
similar to RSS feeds?
 

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