Very creative Dave.
Here is an example of creating a reference on the fly. The advantage of using the correct type (Dim da As New dataobject) is simply: If the reference is already set, you get early binding which is 2 to 3 times faster than late binding. If the reference is not set, it will be, and, if the user saves the changes, the code will be early bound from thence onward.
<table border="1" bgcolor="White"><caption ALIGN=left>
<font size="2" face=Courier New>Example VBA Code:</FONT></caption><tr><td><font size="2" face=Courier New> <font color="#0000A0">Sub</font> Main()
<font color="#0000A0">If</font> HasReference <font color="#0000A0">Then</font>
RunUsualCode
<font color="#0000A0">Else</font>
<font color="#008000"> 'plan b (whatever that is)
</font>
<font color="#0000A0">End</font> <font color="#0000A0">If</font>
<font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
<font color="#0000A0">Function</font> HasReference() <font color="#0000A0">As</font> <font color="#0000A0">Boolean</font>
<font color="#0000A0">Dim</font> Ref <font color="#0000A0">As</font> Object, fso <font color="#0000A0">As</font> Object, SysFolder <font color="#0000A0">As</font> <font color="#0000A0">String</font>
<font color="#0000A0">Const</font> SystemFolder <font color="#0000A0">As</font> <font color="#0000A0">Integer</font> = 1
<font color="#0000A0">Set</font> fso = CreateObject("Scripting.FileSystemObject")
SysFolder = fso.GetSpecialFolder(SystemFolder)
<font color="#008000"> 'try and load from file first</font>
<font color="#0000A0">Set</font> Ref = ThisWorkbook.VBProject.References.AddFromFile(SysFolder & "\FM20.DLL")
<font color="#008000"> 'if loading from file failed, load using id</font>
<font color="#0000A0">If</font> Ref <font color="#0000A0">Is</font> <font color="#0000A0">Nothing</font> <font color="#0000A0">Then</font>
<font color="#0000A0">Set</font> Ref = ThisWorkbook.VBProject.References.AddFromGuid("{0D452EE1-E08F-101A-852E-02608C4D0BB4}", 2, 0)
<font color="#0000A0">End</font> <font color="#0000A0">If</font>
HasReference = <font color="#0000A0">Not</font> (Ref <font color="#0000A0">Is</font> Nothing)
<font color="#0000A0">End</font> <font color="#0000A0">Function</font>
<font color="#0000A0">Sub</font> RunUsualCode()
<font color="#0000A0">Dim</font> da <font color="#0000A0">As</font> <font color="#0000A0">New</font> dataobject
da.Clear
da.SetText "SomeText"
da.PutInClipboard
<font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
</FONT></td></tr></table>