VBA references by coding

VBA references by coding

Anonymous
Not applicable
225 Views
3 Replies
Message 1 of 4

VBA references by coding

Anonymous
Not applicable
I grabbed this from an earlier message and am having a problem getting
it to work. AutoCAD 14.01, *Misrosoft Visual Basic Extensibility....*
reference is set. I get the *Object variable or With block variable
not set* error, err.number #91. The code has been slightly modified,
and the original code gave the same error.

Thanks,
Monte

Sub AddReference()
Dim objIDE As VBIDE.VBE
Dim FileName As String

FileName = "c:\winnt\system32\my.dll"

On Error GoTo AddReference_Error

Set objIDE = Application.VBE
objIDE.ActiveVBProject.References.AddFromFile FileName
Exit Sub

AddReference_Error:
MsgBox Err.Description & " " & Err.Number, vbCritical, "Cannot Add
Reference "

End Sub
0 Likes
226 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Just to add the code works in 2000, but not in 14.01.

Monte
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi Monte,
The extensability model is different from R14 to R15, but that's not the
problem!
R14 does not have a VBE property, so the code is not setting objIDE equal to
anything.

Randall Rath
VB Design
Home of the Wonder Llama
http://www.vbdesign.net/cadpages/

Join the WORLDS LARGEST AutoCAD VBA code journal,
its free, its fun.
ok, its peanuts
http://www.vbdesign.net/cadpages/acad.htm
0 Likes
Message 4 of 4

Anonymous
Not applicable
On Thu, 12 Apr 2001 19:02:38 -0700, "Randall Rath"
wrote:

>Hi Monte,
>The extensability model is different from R14 to R15, but that's not the
>problem!
>R14 does not have a VBE property, so the code is not setting objIDE equal to
>anything.
>
>Randall Rath
>VB Design
>Home of the Wonder Llama
>http://www.vbdesign.net/cadpages/
>
>Join the WORLDS LARGEST AutoCAD VBA code journal,
>its free, its fun.
>ok, its peanuts
>http://www.vbdesign.net/cadpages/acad.htm
>

Randy,
Is there a way to make this work?

Monte
0 Likes