Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-15-2017, 05:13 AM
slaycock slaycock is offline Macro how to add hyperlink to text in document Windows 7 64bit Macro how to add hyperlink to text in document Office 2016
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

Your explanation still isn't helping.

You've clarified that

1. John 15:1-3 is a single hyperlink
2. John 15:1,2 is a single hyperlink
3. John 15:1,3 is two hyperlinks (and is not the same as the reference John 15:1-3).

So we need to find a way of differentiating cases 2 and 3 by code.

The current rules for finding references are as follows

1. Search for a stem reference.

A stem reference is an Authority name, followed by one or more spaces followed by one or more numbers terminating with a colon e.g. John 15:

2 look at the character after the range containing the reference. Depending on the character found we so one of 4 actions

a. Hypen

b,Comma

c terminating character (semi-colon, period, space, right bracket

d Character not included in a, b or c


If we have case d it is a malformed reference so currently we highlight the reference in red and then continue from 1

If we have case c we insert the hyperlink and continue from 1



if we have case b we insert the hyperlink and then look for a short form reference (which is just a number). If we don't find a number we currently ignore the fact that there was a comma and continue from 1. If we do find a number then we insert a hyperlink which is constructed using the stem reference we found in 1 plus the current number.


Based on the discussion so far I think I have to change the rules above as follows

if we have case b

Preserve the current reference range

Look ahead to see if the comma is followed by spaces then a number ( a short form reference)

Compare the verse number in the stem reference to the verse number in the short form reference.

If the verse number in the short form reference is the verse number in the stem reference +1 then insert a single hyperlink using the stem reference and the short form reference

Otherwise insert two separate hyperlinks.

If the proposal above doesn't work then we are stuck as we have no way of programatically deciding what to do after we find a reference followed by a comma.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro how to add hyperlink to text in document How to embed hyperlink to another document into an ActiveX Control Text Box kenboy21 Word VBA 3 02-24-2017 09:41 PM
Macro (or something) to run Spell Check within rich text content boxes in lock document NMBELL Word 8 12-21-2015 04:09 PM
Macro how to add hyperlink to text in document Moving from hyperlink to hyperlink in a document Bengt Word VBA 2 12-21-2015 12:42 AM
Hyperlink: open the document only once, quit & reopen PP, hyperlink doesnt work anymore quanghuynguyenhua PowerPoint 0 10-10-2015 06:17 PM
Macro how to add hyperlink to text in document Macro for word to add page break and specific text to end of document pizzaman1 Word VBA 6 11-14-2014 11:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:35 PM.


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