Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

go to a specific place on open

Status
Not open for further replies.

cwash

Technical User
May 27, 2002
45
US
i'm using word 2000. i have a large doc made up of section breaks; page breaks and tables.

when i open the doc the cursor is at the very top of the doc; but i want the cursor to be in the center of the doc so that when i open the doc a reader will see the centered text instead of the top of the doc which contains nothing. i'm trying to avoid haveing a reader scroll down to the openning text. i've tried bookmarks and headings with no results.

so...how do i get the cursor to be at a specific location when i open the doc?



 
Word remembers that last 5 edit points in an open (actively edited) document and remembers the final edit point in a document that is saved and closed. You can use the GoBack command (Shift+F5) to toggle around the 'remembered' edit points.

You can automate this on File Open by creating an AutoOpen macro that includes GoBack.

Regards: tf1
 
how do i write the macro? i'm not savvy in working with macro's...can you give me the 'code' to move the cursor to where i want it to be when openned?

tia
 
Create a Macro (Tools, Macro) and call it AutoOpen. Use the code

Application.goback

and save the macro.

Regards: tf1
 
Hi cwash,

Another option is to create a shortcut to the middle of the document:

[ul][li]Resize your Word window so that you can see the desktop.[/li][li]Select something at the point you want to be (AFAIK you must select something, anything)[/li][li]RIGHT Click and drag the selection to the desktop[/li][li]When you drop it, select "Create Shortcut Here" from the popup menu[/li][li]Close and save your document[/li][/ul]

The shortcut will then open the doc at the selection

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Application.GoBack returns the cursor to the last location the cursor was at on document close.

If I understand correctly, you have large centered text at the beginning of the document, and you want the opening cursor to be THERE - not at the blank area above it (that is, the actual beginning of the document.

Correct? At least it sounds sort of that way.
i want the cursor to be in the center of the doc

This is a bit fuzzy...if you have a 23 page document, do you want the opening cursor at page 12? What precisely do you mean by "center of the doc"?

Clarification would help to understand precisely where you want the opening cursor location to be. If this location never changes, and you know where that is, here is a solution.

1. go to that location.

2. Select Insert > Bookmarks and type in "Here", and then click Add. This inserts a bookmark "Here" at that location.

3. Click OK.

4 presss Alt-F11 to go into the Visual Basic Editor.

5. Look for a smallish window titled "Project Explorer". If you can not see it, press F4.

6. Within the Project Explorer, locate the document you are working with. It will show as Project (filename.

7. Click on any + signs associated with Project (filename, until you find a sub-item displayed as ThisDocument. It is under a folder named Microsoft Word Objects. However, you can change the viewing structure of Project Explorer so folders are not visible, so the best thing is to click all possible + signs until you find "ThisDocument"

8. Select "ThisDocument" and press F7. This opens the code window for "ThisDocument".

9. There are two dropdowns at the top of the code window. At the top left it will display "General". Click this dropdown, and select "Document".

10. The right hand dropdown will change and display "New". A Sub routine will have been inserted into the code module named Document_New() - ignore it.

11. Select "Open" from the top right dropdown. A Sub routine named Document_Open() will be inserted into the code module.

12. In the line after Sub Document_Open(), and before the line "End Sub", copy and paste the following:

Selection.GoTo What:=wdGoToBookmark, Name:="Here"

13. Save and close the document.

Whenever the document opens it will go to that bookmark. NOTE: if you place text before the bookmark this will obviously move the bookmark forward in the document. The code above will always go to the bookmark, regardless of its location.

As it is not prefectly clear to me, if you want to literally go to the "center" of the document, by the numbers...

Instead of the Selection going to a bookmark, you could have the cursor (the Selection point) go to the precise mathematical "centre" of the document. This is based on the actual numbers of characters in the document. In the Document_Open Sub put in some different code. It should look like this:

Code:
Sub Document_Open()
Dim lngPos As Long
lngPos = CLng(ActiveDocument.Content.End / 2)
With Selection
    .Start = lngPos
    .End = lngPos
End With
End Sub

As I said, this will bring the cursor to the exactly mathematical centre of the document.

Gerry
 
Gerry...

You have it right..."If I understand correctly, you have large centered text at the beginning of the document, and you want the opening cursor to be THERE - not at the blank area above it (that is, the actual beginning of the document.)

Correct? At least it sounds sort of that way."

I will try your tip tonight and let you know!

Thanks!
 
Gerry...

Thanks so much! I responded earlier saying that I was going to try your tip tonight but after reading your tip I decided to go ahead and give it a shot!

Your first assesment of my issue was correct! The tip you offered also give me exactly what I wanted!!! Thanks again.

BTW...you did a very good job detailing the exact steps to your tip!

Thanks again!
C

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top