DrTribos
asked on
MS Word Cross References and VBA
Hi All
Seasons Greetings...
I have a cross reference in MS Word: { REF _Ref344571714 \r \h } which links to a numbered item.
What I would like to do is display the corresponding paragraph number & other reference informatoin in a VBA MsgBox...
would love some help on this one, it has been driving me nuts :-(
Cheers, S
Seasons Greetings...
I have a cross reference in MS Word: { REF _Ref344571714 \r \h } which links to a numbered item.
What I would like to do is display the corresponding paragraph number & other reference informatoin in a VBA MsgBox...
would love some help on this one, it has been driving me nuts :-(
Cheers, S
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Terry & Graham
Thank you both for your help. I think I'm close to getting what I need.
I'm trying to get the para text to display based on a clicked field... so was adapting Graham's suggestion and trying this:
Cheers, S
Thank you both for your help. I think I'm close to getting what I need.
I'm trying to get the para text to display based on a clicked field... so was adapting Graham's suggestion and trying this:
Set para = ActiveDocument.Bookmarks(aField.Code).Range.Paragraphs(1)
This fails due to too much information... ? aField.Code
REF _Ref344627521 \n \h \t
Is there a way to return the reference without switches? Otherwise I'll have to brush upon my text trimming...Cheers, S
ASKER
Would this be robust?
I'm sure 6 will be fine... but can I always expect a 13 character ref?
? mid(aField.Code, 6, 13)
_Ref344627521
I'm sure 6 will be fine... but can I always expect a 13 character ref?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both.
Terry you have answered the question and provided lots of good info - thanks.
Graham - thank you for your additional comments. I am using nested fields so your approach will probably save me the most time.
Terry you have answered the question and provided lots of good info - thanks.
Graham - thank you for your additional comments. I am using nested fields so your approach will probably save me the most time.
The Cross Reference system uses hidden bookmarks, so you need some code like this:
Open in new window