Has anyone else tried to use the BW700 com object to use Bibleworks functionality in MS Office? I've been tinkering with Excel and VBA, with the following proof-of-concept code below, but I'd be interested in what other people have tried. The purpose is to use Excel functions to retrieve bible text, e.g. the code below can be used in a cell in Excel with the formula =BWGetRef("John 1:1").

Public Function BWGetRef(sRef As String, Optional sDisplayVer = "NIV NIV", Optional bShowRef As Boolean = False, Optional bShowFirstVerse As Boolean = False)
Dim bwApp As bw700.Automation
Dim doClip As DataObject
Dim sOldDisplayVersions As String
Dim sData As String

Set bwApp = New bw700.Automation
sOldDisplayVersions = bwApp.GetVersions()
bwApp.SetVersions sDisplayVer
bwApp.ClipGoToVerse True
bwApp.GoToVerse sRef
Set doClip = New DataObject
doClip.GetFromClipboard
sData = doClip.GetText()
If Not bShowRef Then
sData = Mid(sData, InStr(sData, ":") + 1)
If Not bShowFirstVerse Then
sData = Mid(sData, InStr(sData, " ") + 1)
End If
End If
BWGetRef = sData
Set doClip = Nothing
bwApp.SetVersions sOldDisplayVersions
Set bwApp = Nothing

End Function

p.s. VBA project references need to be added to Bibleworks and c:\windows\system32\fm20.dll for this to work.