How to set cursor location?

B

Bob Alston

How do I set the cursor location to a bookmark?

After the user clicks on a button to fire vba, if I go to another
windows task and return, it seems the button fires again.

Bob
 
P

Pesach Shelnitz

Hi Bob,

A bookmark can mark a point in your document or it can enclose a block of
text or other things in your document. The following line verifies that a
bookmark named MyBookmark and selects it.

If ActiveDocument.Bookmarks.Exists("MyBookmark") = True Then
ActiveDocument.Bookmarks("MyBookmark").Select
End If

If the bookmark marks more than a point and you want the cursor to be at the
insertion point at the beginning of the bookmark contents, add the following
line.

Selection.Collapse Direction:=wdCollapseStart

With regard to your section question, could you provide a more detailed
description of what you see happening?
 

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