Results 1 to 3 of 3
Thread: VBS for CommandButton
2015-04-28, 15:01 #1
- Join Date
- Apr 2015
- Thanked 0 Times in 0 Posts
VBS for CommandButton
Still learning word and I have a pretty simple question that I'm hoping you can help with. I'm trying to create a button in a word document to add at the bottom of each page that will take me to the first page. It's a knowledge database and the different sections are hyperlinked, but once you get to the section you have to scroll to the top to get to the index again. I want to insert something that will be at the bottom of each page, so the user can click and be taken back to the index quickly.
2015-04-28, 15:45 #2
- Join Date
- Mar 2004
- Manning, South Carolina
- Thanked 1,454 Times in 1,323 Posts
2015-04-28, 18:13 #3
A CommandButton may be overkill for functionality that is already built-in. Try this (I'm using Word 2010 for this example):
1. Create a new document.
2. Create some random text by typing the following then pressing Enter: =rand(10,10)
3. If you're not already at the bottom of the last page, use Ctrl+End together (similar to RetiredGeek's example above).
4. Using the Insert tab on the ribbon, select Hyperlink.
5. In the Insert Hyperlink dialog, select Place in This Document in the left-hand pane.
6. Select the pre-defined location Top of the Document in the right-hand pane then click on the OK button.
This will create a text hyperlink to the top of the document without having to create a CommandButton nor write any VBA. You can amend the text of the hyperlink to anything you want, e.g. Click to return..., etc. If you hover your mouse pointer over the hyperlink you will see context help informing you to use Ctrl+Click to follow the hyperlink. Note that this isn't a feature of the .docx format, it works for earlier .doc formats as well. You can even create your own hidden bookmarks and hyperlinks to them.
Just in case, I've attached a Word doc with examples of 3 different uses of hyperlinks, i.e. 1) Pre-defined, 2) Heading, and 3) Bookmark.
Hope this helps...