#1
|
|||
|
|||
Runtime error 5828, invalid bookmark name - hyperlink page number index
Split from this thread. (Code from macropod)
Quote:
I have started the macro and get the error message "Runtime error 5828, invalid bookmark name. In the debugger it looks like this: .Bookmarks.Add Name:=StrIdx & i, Range:=.Duplicate Unfortunately I have no idea about VBL, can someone help me? I am working with Word 365. Thanxs Hmelk Last edited by Charles Kenyon; 09-26-2023 at 11:41 AM. |
#2
|
|||
|
|||
I've split your question into a new (unsolved) thread in the vba forum so that it can get better attention.
|
#3
|
||||
|
||||
There are rules for valid characters for bookmark names and it appears your code is trying create a bookmark with a name that is considered invalid. From memory, bookmarks can't start with a number, nor can they contain a space for instance. There are probably other rules on what is allowed as a bookmark name.
When you encounter the error and choose to Debug, hover over the StrIdx to see its value and make note of what it says. Do any characters appear to be unacceptable as bookmark names?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
Thanks for the tip, I found something out. It works when the displayed text is the same as the highlighted text.
"House=house" works, "house=house, old" does not work. How to change this? Thanxs Hmelk |
#5
|
|||
|
|||
Hello,
there must not be any spaces, (),* in the index word. But underscores_are. If I do it like this: A_house = Build_a_house Then it works. Later replace the _ with spaces in the HTML index and it looks OK again. Maybe it's not such an elegant solution, but it seems to work. Hmelk |
#6
|
|||
|
|||
Hello,
now this error message appears. Does anyone have any idea what I am doing this wrong? Runtimeerror 4120, Wrong Papameter .Hyperlinks.Add Anchor:=.Words(j), SubAddress:=GetBkMk(Trim(.Words(j).Text), StrIdx), TextToDisplay:=.Words(j).Text Thanks Hmelk |
#7
|
|||
|
|||
Hello,
I have found the problem, I mean. I had created the markers automatically via a Word file. This also entered markers in the footnotes index. When I deleted those, I got an index with hyperlink. I will test this further tomorrow. Hmelk |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to hyperlink an index entry to a bookmark in a document? | Ashok P | Word VBA | 2 | 02-28-2021 03:18 PM |
Can I use a variable to display the page number of a bookmark ? | delboy | Word | 3 | 12-29-2020 01:16 PM |
use hyperlink in page number in index | boywonder | Word | 2 | 07-27-2017 03:18 PM |
Runtime error 5487 - Word cannot complete the save to to file permission error | franferns | Word | 0 | 11-25-2009 05:35 AM |