Results 1 to 10 of 10
  1. #1
    New Lounger
    Join Date
    Jan 2003
    Location
    Tempe, Arizona, USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A ... Z Hyperlink into Tables (2002)

    I am a novice. I have created Tables with my Music CD's, Artist, Title, Slot (location in JukeBox), and Track #. I have one table sorted alphabetically by artist and one sorted by title. I wish to create a way that would allow me to select either Artist, or Title, by using a click on letter A thru Z and the cursor will go directly to that group of artists or titles. I would appreciate any help offered, and would like to use e-mail to discuss the subject. I see this sort of thing done on web pages.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    Word supports hyperlinks, and they work similarly to the way they work on web pages. However, it is a bit tedious to set them up.

    In your table, you place a bookmark for each letter of the alphabet. For example, in the Artist table, you would have bookmarks with names like ArtistA, ArtistB, ... ArtistZ, and in your Titles table, you would have bookmarks with names like TitleA, TitleB, ... TitleZ.

    Next, you create a row at the top of each table (or at the top of your document) with the letters A through Z. Select the letter A, press Cltr+K, and assign the bookmark ArtistA. Repeat 51 times to assign all of the letters.

    There may well be better (or easier) ways to do this that don't involve emulating the hyperlink functionality of web pages, but if you like this style, that's how you do it in Word.

    > I would appreciate any help offered, and would like to use e-mail to discuss the subject.

    If you mean, you would like private replies, then you picked the wrong Lounge. <img src=/S/smile.gif border=0 alt=smile width=15 height=15> All useful replies are to be posted in the original thread in accordance with <!rule=10>Rule 10<!/rule>.

  3. #3
    New Lounger
    Join Date
    Jan 2003
    Location
    Tempe, Arizona, USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    Thanks for the info about hyperlinks. I'm not sure I am quite up to that speed in working with Word. Sorry, about the statement on e-mai. Was only thinking working out details would been easier without clogging up the Lounge. I surely have nothing to say that couldn't be posted.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    No problem, the first day is always the hardest. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    For a hilarious radio program on various "first day" experiences, visit Program 115 in the online archives of This American Life.

    I'm having trouble coming up with simpler solutions. You can try marking Table of Contents entries in the same places that you would have inserted bookmarks, but the Table of Contents that you generate will consume 52 lines, so it isn't very efficient.

    I wish I could think of a search that would find, say "A" as the first character in a table cell, but I haven't found the logic. If I did, I might create a toolbar dropdown for Artist (and another one for title) with A-Z. Pick a letter, and the document would automatically scroll to that line using a find. Since the toolbar would remain visible, you could use it to skip around without going back to the top. But I need that magic find string. Or maybe someone else has an idea?

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    Well, to follow up on your idea, I suppose one could create 26 rows, each with a single letter A through Z. Then you could use a search for a particlular capital letter, with the option of whole word or perhaps using wildcards not followed by a period. Of course you would have to create a macro for each separate search, wouldn't you? I don't think that would be any easier than the bookmark method, which probably wouldn't take more than 1/2 hour to set up. <img src=/S/clever.gif border=0 alt=clever width=15 height=15>

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    > you would have to create a macro for each separate search, wouldn't you?

    Actually, the nice thing about working with the dropdown control is that a single macro can read out the control's contents and branch from there: just plug the A into the find text spec...

    But it turns out a that combination of both of these methods could be the fastest. If one were to go through the tables and add the bookmarks, one then could use the code in <!post=Post #165392,165392>Post #165392<!/post> to populate a drop-down control with the names of the bookmarks (e.g., ArtistA, ArtistB...TitleY, TitleZ). Synergy! (Or even better, code re-use!)

    All we need now is a macro that, given a prefix for the bookmarks for the currently selected table, inserts the bookmarks automatically. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  7. #7
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    I'm in over my head here but I thought I would add my piece.

    The macro in the Post #165392 is very neat. Is it possible for it to populate the drop-down control using a particular format Style instead of a bookmark? The A, B, C headings could than be formatted using that Style which would reduce the amount of work involved in setting it up.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    You could use styles, and as you point out, applying (creating) a style manually is a bit easier than inserting a bookmark manually, so this could save labor in the set-up. But I think I still like the bookmark method better. From the macro writing perspective, the "goto" to go to a bookmark is easier to code than a style search, and doesn't risk messing up the Find dialog for the next search. From the document maintainability perspective, updating 52 different styles would be a hassle if you ever had to do it.

  9. #9
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    Here is a Macro that will add the Bookmarks for you. You should be able to combine this with Jefferson's Goto Bookmark drop down...

    Public Sub AddBmks()
    Dim clTemp As Cell
    Dim strInitial As String, strOldInitial As String
    Dim bmkTemp As Bookmark

    ' Display a message and exit if we are not in a table
    If Not Selection.Information(wdWithInTable) Then
    MsgBox "Not in a table", vbOKOnly
    Exit Sub
    End If
    ' Make sure the table is sorted into Alphabetical order
    Selection.Tables(1).Sort ExcludeHeader:=False, FieldNumber:="Column 1", _
    SortFieldType:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending

    ' Remove any old bookmarks
    For Each bmkTemp In Selection.Tables(1).Range.Bookmarks
    If Left(bmkTemp.Name, 5) = "Title" Then bmkTemp.Delete
    Next bmkTemp

    ' Add new bookmarks whenever initial letter in Column 1 changes
    strOldInitial = ""
    For Each clTemp In Selection.Tables(1).Columns(1).Cells
    strInitial = UCase(Left(clTemp.Range.Text, 1))
    If strInitial <> strOldInitial Then
    strOldInitial = strInitial
    ActiveDocument.Bookmarks.Add Name:="Title" & strInitial, Range:=clTemp.Range
    End If
    Next clTemp
    End Sub

    StuartR

  10. #10
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: A ... Z Hyperlink into Tables (2002)

    Rather than adding bookmarks which will leave you with the hyperlinking problem, what about adding index entries or TOC entries. Both of those will give you automatic hyperlink generation.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •