Setting the cursor for a new document

L

Lüko Willms

Using MS-Word, I want to put the cursor at a specific place in
a new document which is being created on the basis of a template
which contains some VBA programming with a "Document_New" procedure.

The cursor should not be at the very top of the first page,
but at a specific, still empty, paragraph. The text before is part of
the template resp. generated via Fields.

I tried a

ActiveDocument.Goto What:=wdGoToBookmark, Name:="myBookmark"

and alternatively

ActiveDocument.ActiveWindow.Goto What:=wdGoToBookmark,
Name:="myBookmark"

but it did not help.

What is the correct way to do this? What am I missing?


Yours,
L.W.
Germany
 
S

Shauna Kelly

Hi Lüko

Here is one way:
ActiveDocument.Bookmarks("MyBookmark").Select

If the bookmark covers several characters or words, you might then do:
Selection.Collapse wdCollapseStart 'or wdCollapseEnd

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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