Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-19-2015, 08:05 PM
Redgum Redgum is offline Formatting for internal hyperlinks question. Windows 7 32bit Formatting for internal hyperlinks question. Office 2010 32bit
Novice
Formatting for internal hyperlinks question.
 
Join Date: Sep 2015
Posts: 9
Redgum is on a distinguished road
Default Formatting for internal hyperlinks question.

Hi All



I am trying to insert internal hyperlinks into a novel I've written, in order for readers to be able to navigate from the chapter headings in the contents section to the desired chapter (within an ebook).

I highlighted the relevant chapter, clicked Add Bookmark, and then went to the chapter reference in the contents section and highlighted it, then clicked add Hyperlink. No problem - worked perfectly.

The issue is a technical one about Kindle ebook previews, because in their previewer they have a dropdown menu which should (but in my case did not) include "contents".

However, the real issue is a Word one, because I know there is another way to format a document with internal hyperlinks (other than the one I describe above) and I know that way works and gives me what I want in the Kindle previewer.

So... can anyone help me with alternative ways to insert internal hyperlinks other than the way I describe above?

Sincere thanks

Regards
R
Reply With Quote
  #2  
Old 09-19-2015, 08:43 PM
macropod's Avatar
macropod macropod is offline Formatting for internal hyperlinks question. Windows 7 64bit Formatting for internal hyperlinks question. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

A Table of Contents in Word automatically hyperlinks to the corresponding headings - provided you've set things up correctly. The simplest way to do the setup is to use Word's heading Styles; the Table of Contents (TOC) field automatically picks those up.

Accordingly, I don't follow what you mean by:
Quote:
Originally Posted by Redgum View Post
I highlighted the relevant chapter, clicked Add Bookmark, and then went to the chapter reference in the contents section and highlighted it, then clicked add Hyperlink. No problem - worked perfectly.
If you're using a Word Table of Contents, anything you add to it will be lost as soon as it updates (e.g. by previewing/printing the document)

Since a Word Table of Contents won't work in the ebook format, what you could do is to use a Word Table of Contents for editing purposes and, when you're done convert it to hyperlinks, which is what the following macro does:
Code:
Sub ConvertTOC2Hyperlinks()
Dim RngTOC As Range, RngItem As Range, StrBkMkList As String, StrTmp As String, i As Long
With ActiveDocument
  With .TablesOfContents(1)
    .Update
    If InStr(.Range.Fields(1).Code.Text, "\n") = 0 Then
      For i = 3 To .Range.Fields.Count Step 2
        StrBkMkList = StrBkMkList & "|" & Split(Trim(.Range.Fields(i).Code.Text), " ")(1)
      Next
    Else
      For i = 2 To .Range.Fields.Count
        StrBkMkList = StrBkMkList & "|" & Replace(Split(Trim(.Range.Fields(i).Code.Text), " ")(2), """", "")
      Next
    End If
    Set RngTOC = .Range
  End With
  RngTOC.Fields.Unlink
  For i = 1 To UBound(Split(StrBkMkList, "|"))
    Set RngItem = RngTOC.Paragraphs(i).Range
    RngItem.End = RngItem.End - 1
    StrTmp = Replace(Split(StrBkMkList, "|")(i), "Toc", "HL")
    .Bookmarks.Add Name:=StrTmp, Range:=.Bookmarks(Split(StrBkMkList, "|")(i)).Range
    .Bookmarks(Split(StrBkMkList, "|")(i)).Delete
    .Hyperlinks.Add Anchor:=RngItem, SubAddress:=.Bookmarks(StrTmp).Range, _
      TextToDisplay:=.Bookmarks(StrTmp).Range.Text
  Next
End With
End Sub
For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-19-2015, 08:54 PM
Redgum Redgum is offline Formatting for internal hyperlinks question. Windows 7 32bit Formatting for internal hyperlinks question. Office 2010 32bit
Novice
Formatting for internal hyperlinks question.
 
Join Date: Sep 2015
Posts: 9
Redgum is on a distinguished road
Default

Hi Macro & many thanks for your reply.

To clarify the bit you say you don't understand - I literally just typed the document from start to finish, no formatting. Then typed a contents page at the start with a list of the chapters. Then simply connected the corresponding chapters to their counterparts in the contents page using the Bookmarks/Hyperlinks method I describe. So a very manual process in an unformatted document (which is why I guess it didn't work.)

Macros are most definitely way over my head, as you can probably tell from the ham-fisted way I did my hyperlinks. So if you could dumb it down a bit I'd be grateful. R

Last edited by macropod; 09-19-2015 at 10:39 PM. Reason: Deleted superfluous quote of entire post replied to
Reply With Quote
  #4  
Old 09-19-2015, 09:22 PM
macropod's Avatar
macropod macropod is offline Formatting for internal hyperlinks question. Windows 7 64bit Formatting for internal hyperlinks question. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The first thing you need to learn about working with Word is how to use Styles properly. They make complex document construction and maintenance a snap. Start with:
http://www.addbalance.com/usersguide/styles.htm

For a basic understanding of how a Word Table of Contents (TOC) field works with Word's Heading Styles, see the attachment at: https://www.msofficeforums.com/word/...html#post16114.
Note how the Table of Contents also hyperlinks to the relevant headings. This is just one example of how using Styles facilitates document creation & management - edit/delete/add a heading, then preview the document and the Table of Contents updates itself!
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 09-19-2015, 10:31 PM
Redgum Redgum is offline Formatting for internal hyperlinks question. Windows 7 32bit Formatting for internal hyperlinks question. Office 2010 32bit
Novice
Formatting for internal hyperlinks question.
 
Join Date: Sep 2015
Posts: 9
Redgum is on a distinguished road
Default

Hi Paul

This is very helpful so thanks. I've had a read through and managed to set up a short test doc. where I used the Headings/Styles to create a TOC and it all worked very well, which I was happy with, except when I export to PDF they no longer work, and I know this means they will not work when I upload to Kindle either.

Any ideas?

Thanks, R

Last edited by macropod; 09-19-2015 at 10:39 PM. Reason: Deleted superfluous quote of entire post replied to
Reply With Quote
  #6  
Old 09-19-2015, 10:42 PM
macropod's Avatar
macropod macropod is offline Formatting for internal hyperlinks question. Windows 7 64bit Formatting for internal hyperlinks question. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Whether a Word Table of Contents works in a PDF depends on how the PDF conversion is done. Nevertheless, that's irrelevant for your purposes and it's also where the macro in post #2 comes into play.

PS: Please don't keep quoting entire previous posts in your replies. Doing so just adds clutter - only quote the bits that need to be quoted (if any).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 09-19-2015, 11:36 PM
Redgum Redgum is offline Formatting for internal hyperlinks question. Windows 7 32bit Formatting for internal hyperlinks question. Office 2010 32bit
Novice
Formatting for internal hyperlinks question.
 
Join Date: Sep 2015
Posts: 9
Redgum is on a distinguished road
Default

Paul - I've got it nailed. My big mistake was presuming failure to export to PDF meant failure to export to Kindle (based on previous experience) but I managed to set up as per your advice and it transported into Kindle.

So,
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Number Formatting Question Redgum Word 3 09-17-2015 04:08 PM
Formatting for internal hyperlinks question. Drop down menus colour formatting - Newbie question TerryStevenson Word 2 09-17-2013 10:43 AM
Formatting for internal hyperlinks question. Conditional formatting question based on cell date Cosmo Excel 2 04-08-2013 12:12 PM
Formatting for internal hyperlinks question. Formatting question... rwear Word 1 01-30-2011 11:36 PM
Excel 2007 - Question on conidial formatting? jerrymbna22 Excel 2 03-24-2010 11:48 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft