Convert Bible refs to hyperlinks in Word / Pages

Page 1 of 1 (3 items)
This post has 2 Replies | 1 Follower

Posts 60
Stephen Harper | Forum Activity | Posted: Wed, Jun 27 2018 6:04 AM

I'm sorry if this has been covered elsewhere in this forum, but at present the search facility seems to be broken and I can't search earlier posts.

I'm looking for a simple way to search for all Bible references in a Word document and convert them to logosres or URL links - a bit like reftagger only in a Word document.

Does such a macro exist?  I use Word on both Mac and Windows so have access to either versions of the app as well as Pages



Posts 397
PJ | Forum Activity | Replied: Wed, May 15 2019 1:31 PM
I know this is an old post but maybe this could help to give a starting point:

Sub FindAllReferences(Optional pDataType As String = "Bible")
    'I use latebinding for illustration purposes
    Dim Logos As LogosApplication
    Dim Launcher As LogosLauncher
    On Error Resume Next
    'Try to get the running instance of logos first
    Set Logos = GetObject(, "LogosBibleSoftware.Application")
    'If it is not running, try to execute it using the Logos Launcher
    If Err.Number = 429 Then
        Set Launcher = CreateObject("LogosBibleSoftware.Launcher")
        'Wait for the App to load
        While Logos Is Nothing
            Set Logos = Launcher.Application
    End If
    On Error GoTo ErrHandler
    Dim LDPRC As LogosDataTypeParsedReferenceCollection
    Dim DTPR As LogosDataTypeParsedReference
    Set LDPRC = Logos.DataTypes.GetDataType(pDataType).ScanForReferences(ActiveDocument.Range)
    For Each DTPR In LDPRC
        Debug.Print DTPR.Reference.Render("long"), DTPR.TextIndex, DTPR.TextLength, DTPR.Reference.Save()
        pos1 = DTPR.TextIndex
        pos2 = DTPR.TextIndex + DTPR.TextLength
        'ActiveDocument.Hyperlinks.Add Anchor:=ActiveDocument.Range(pos1, pos2), Address:= _
        "logosres:esv;ref=" & DTPR.Reference.Save(), SubAddress:="", ScreenTip:=DTPR.Reference.Render("long")
    Exit Sub
    'Trap unexpected errors
    MsgBox Err.Description
End Sub
Posts 397
PJ | Forum Activity | Replied: Wed, May 15 2019 1:35 PM

You will need to render all References to the same format first before adding hyperlinks otherwise the documents length will change and indexes and  lengths won't match.

When you create a personal book from a word document in Logos Bible Software the references for the Bible DataType are automatically linked. You don't need a macro to do this.

Page 1 of 1 (3 items) | RSS