Pages

Sabtu, 07 Juli 2012

Use Word macros to save your place in a document

Takeaway: Use these two simple Word macros to temporarily bookmark a spot you want to return to later.
Large documents offer a few navigating challenges, especially when you need to jump back and forth between two areas. You could split the document, but that splits the screen and that might not be the right solution for you. Or, you could use any of the normal navigation tools and shortcuts, but it’s easy to get lost that way. Using VBA, you can insert a bookmark that acts as a placeholder. Then, when you’re ready to return, a single quick click is all that’s required.

This technique requires two quick macros, which follow:
Public Sub InsertBookmark()
  'Insert bookmark for ssh.
  Call Bookmarks.Add("ssh", Selection.Range)
End Sub
Public Sub ReturnToBookmark()
  'Return to previously inserted bookmark.
  ActiveDocument.Bookmarks("ssh").Range.Select
End Sub
I used my initials to identify the bookmark, but you can use any string you like.
To add the macros, press [Alt]+[F11] to launch the Visual Basic Editor (VBE). In the Project Explorer, find ThisDocument for the current document. Then, enter the two sub procedures shown above.
Next, return to the document and add the macros to the Quick Access Toolbar (QAT), as follows:
  1. From the QAT dropdown, choose More Commands.
  2. From the Choose Commands From dropdown, choose Macros.
  3. In the list on the left, find InsertBookmark.
  4. Click Add to add the macro to the list of commands on the right.
  5. With the macro still selected, click Modify.
  6. In the resulting dialog, enter Mark in the Display Name control, and click OK. You could also change the macro’s display icon.
  7. Repeat steps 3 through 6 to add ReturnToBookmark to the list on the right and add the display name, Return.
  8. Click OK.



In Word 2003, drag the macros to the toolbar as follows:
  1. Launch the Customize dialog box by double-clicking a toolbar or menu or by choosing Customize from the Tools menu.
  2. Click the Commands tab.
  3. Choose Macros from the Categories list.
  4. Find InsertBookmark in the Commands list and drag it to the toolbar.
  5. Find ReturnToBookmark and drag it to the toolbar.
  6. Click Close.
Using the macros is simple. When you want to mark an area, just click the Mark macro on the QAT. Then, go wherever you want. When you’re ready to return to the marked spot, click Return.