Hyperlinks not working correctly when converting word doc to Web Page, Filtered

I have created a word document (MS Word 2013) with Table of Contents and their links to particular sections and all the hyperlinks works fine in the word document. But when I convert this document into Web Page, Filtered then after a specific point the hyperlinks not pointing to their respective sections instead they are pointed to the end of the page.

I have checked the page source of the HTML document and found that the table of contents have hyper links but the respective sections doesn't have the hyper link code and hence click on the a section didn't find the that section and go to the end of the document.

I have tried to convert into PDF and hyperlinks worked fine.

Please advise me how to resolve this issue.

Thanks in advance

Deepak

February 1st, 2015 3:38pm

Hi Deepak,

I can reproduce this issue in my environment. This is the default behavior when we convert Word to Web Page. When we convert Word to web page, it doesn't separate content into pages like Word or PDF does. So, there is no much space if we scroll to the end of the web page. When we click a hyperlink to a section which is at the bottom of the web page, it will only go to the end of the document.

To work around this issue, we need to add enough spaces (press Enter for several times until the mouse cursor is at the end of current page) at the end of the document and then convert it to Web Page.

If you still have any question on this issue, please don't hesitate to post back.

Regards,

Steve Fan

Forum Support

Free Windows Admin Tool Kit Click here and download it now
February 3rd, 2015 6:28pm

Hi Deepak,

Just checking in to see if the information was helpful. Please let us know if you would like further assistance. 

Best Regards,

Steve Fan

Forum Support

February 8th, 2015 8:28pm

I tried to do the same but didn't get any success.

Please see below the link of the word document, it might help to reproduce the issue on your end.

http://1drv.ms/1zVE5Nz


Please let me know if there is any other trick to fix this issue.

Thanks,

Deepak

Free Windows Admin Tool Kit Click here and download it now
February 10th, 2015 9:05pm

The following macro converts a Table of Contents to Hyperlinks (without page #s). Since hyperlinks don't update the way TOC fields do, it's probably best to not do the conversion until the document is otherwise finalised. These hyperlinks may survive your HTML conversion better than the standard conversion.

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
E

February 11th, 2015 4:18am

Dear Paul,

Thanks for your help but I tried to execute this macro and I got the error.

"Run time error: 5941

The requested member of the collection doesn't exist."

I have tried to attache screen shot but site doesn't allow me to do that and I am getting message that my account is not verified yet so can't attach any email or link.

Please check this issue and provide me the solution. 

Thanks in advance.

Deepak


Free Windows Admin Tool Kit Click here and download it now
February 11th, 2015 8:29am

I've revised the code. Try it now.
February 11th, 2015 2:46pm

Hi,

Just checking in to see if the information from Paul was helpful. Please let us know if you would like further assistance.

Regards,

Melon Chen

Forum Support

Free Windows Admin Tool Kit Click here and download it now
February 15th, 2015 10:07pm

Hi Paul,

I couldn't find the revised code, could you please post it again.

Thanks,

Deepak

February 16th, 2015 2:34am

Paul edited his previous post; it should now include the updated code.

Free Windows Admin Tool Kit Click here and download it now
February 16th, 2015 8:48am

Hi Paul,

I tried the revised code now it's working with any errors but once I run it on the word document and then covert to the Web page filtered then it removes Table of contents list completely.

I also tried to run it on the webpage filtered file but then it shows error.

Please advise.

Thanks,

Deepak

February 17th, 2015 5:08am

Since the Table of Contents gets converted to a series of hyperlinks by the macro, I can't see how it would simply 'disappear'. Are you using a Table of Contents inserted via References|Table of Contents? If so, try deleting that and inserting one via Insert|Quick Parts|Field. The former embeds the Table of Contents in a content control, and that may be causing issues.
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2015 6:18am

Hi Deepak,

Any update on this issue? Have you got any opportunity to try Paul's method?

Regards,

Steve Fan

Forum Support

February 24th, 2015 8:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics