ActiveX and page fault in modile VBA332.dll

ActiveX and page fault in modile VBA332.dll

Anonymous
Not applicable
267 Views
5 Replies
Message 1 of 6

ActiveX and page fault in modile VBA332.dll

Anonymous
Not applicable
Can anyone help me with this problem !

My ActiveX session from Excel crashes when i use InsertBlock- method. On on
other machines (NT 4.0) program works but in Win 95 it doesn't. It looks
like i cannot retrieve all properties and methods of AutoCAD 14 (or 2000)
objects through ActiveX.

My program is able to open AutoCAD 14, then open a new drawing, fill in some
attribute-data in certain block, but when inserting a drawing the program
just crashes and gives an error:

"Excel...page fault in module VBA332.DLL"

I have used NukeDLL- program to see what modules are loaded when VBA is
launched and excactly same .DLL:s (and from the same directories) are loaded
when VisualBasic Editor is launched from Excel or AutoCAD 14.

My program also works inside AutoCAD with needed modifications (removing
application object from the beginning of statement like
"acs.activedocument.insertblock......"
0 Likes
268 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Can you post your code?

"Arno Vilén" wrote in message
news:1E857810AC420DC05DE212D864398803@in.WebX.maYIadrTaRb...
Can anyone help me with this problem !

My ActiveX session from Excel crashes when i use InsertBlock- method. On on
other machines (NT 4.0) program works but in Win 95 it doesn't. It looks
like i cannot retrieve all properties and methods of AutoCAD 14 (or 2000)
objects through ActiveX.

My program is able to open AutoCAD 14, then open a new drawing, fill in some
attribute-data in certain block, but when inserting a drawing the program
just crashes and gives an error:

"Excel...page fault in module VBA332.DLL"

I have used NukeDLL- program to see what modules are loaded when VBA is
launched and excactly same .DLL:s (and from the same directories) are loaded
when VisualBasic Editor is launched from Excel or AutoCAD 14.

My program also works inside AutoCAD with needed modifications (removing
application object from the beginning of statement like
"acs.activedocument.insertblock......"
0 Likes
Message 3 of 6

Anonymous
Not applicable
Here is my code partially..

Public AcS As Object
Public blkelem As Object

Private Sub CommandButton1_Click()

Set AcS = GetObject(, "AutoCAD.Application")
......
'Some error checking here
.....
Set AcS = CreateObject("AutoCAD.Application")
protopath = "C:\DRAWINGS\"
AcS.activedocument.new (protopath + "protox.dwg") 'protox.dwg exists
.....
tayt_bltaul 'subr to insert block
......

end sub

' here is the subroutine for inserting blocks

Sub tayt_bltaul()

Dim elem As Object
Dim bl As Object
Dim insp As Variant

....

insp = elem.InsertionPoint 'Elem is a block and it is assigned a point
....
block_name = "C:\DRAWINGS\" & "VIRHE.DWG"
Set bl = AcS.activedocument.modelspace.InsertBlock(insp, block_name, 1#, 1#,
0)

'I have checked that all parameters of InsertBlock- function are valid
(insp, block_name) but this is
'the point where it crashes.

....

End Sub
>Can you post your code?
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
> AcS.activedocument.new (protopath + "protox.dwg") 'protox.dwg exists

Try AcS.Documents.Open protopath + "protox.dwg" instead.

Because, if there's no active document when you call AcS.ActiveDocument,
you'll get an error.

Hope that will fix your problem.

Alain
0 Likes
Message 5 of 6

Anonymous
Not applicable
Sorry, I didn't read the whole message. Here's something else:

> Dim insp As Variant
> insp = elem.InsertionPoint 'Elem is a block and it is assigned a point
> block_name = "C:\DRAWINGS\" & "VIRHE.DWG"
> Set bl = AcS.activedocument.modelspace.InsertBlock(insp, block_name, 1#,
1#, 0)

insp should not be a variant, I get an error at this line (something like:
byref argument not allowed). Declare an array of doubles, assign insp to it
and pass this array to the insertblock function.

Or just:

> block_name = "C:\DRAWINGS\" & "VIRHE.DWG"
> Set bl = AcS.activedocument.modelspace.InsertBlock(elem.InsertionPoint,
block_name, 1#, 1#, 0)

Hope this helps.

Alain

Alain Bouchard wrote in message
news:36136698C925B6025FF046E436FEC491@in.WebX.maYIadrTaRb...
> > AcS.activedocument.new (protopath + "protox.dwg") 'protox.dwg exists
>
> Try AcS.Documents.Open protopath + "protox.dwg" instead.
>
> Because, if there's no active document when you call AcS.ActiveDocument,
> you'll get an error.
>
> Hope that will fix your problem.
>
> Alain
>
0 Likes
Message 6 of 6

Anonymous
Not applicable
Did you test the code in Excel ? There seems to be lots and lots of strange
behaviour when using autocad through ActiveX. For example:

-Variable "bl as object" must be defined as public in top-level of sheets
code. If not (ie defining bl in side sub as object) insertBlock doesnt work
(this is same with creating other new objects)
-Using Variant was often the only way to make things right. I remember
defining Point as an array of reals, but AutoCAD rejected assigning
bl.insertionpoint to it unless definition was variant.
-When I used an array of Strings and cleand up it with Erase, AutoCAD did
not understand those strings as strings (i debugged the string array and it
was totally correct). I had to make separat cleaning function, which
assigned all strings in array as "".

I dont think there is something wrong with the code, beacuse it works in
three other computers. What i am beginning to be afraid of is, that the
problem emerges from my installation of AutoCAD VBA test-version which was
downloadable from the web before actual 14.01 came to market. I have
uninstalled and installed both office and r14.01 at least twice and am
almost frustrated on the situation.

Alain Bouchard kirjoitti viestissä
<0C72384FB481270658E3E1B4D4F7BA6D@in.WebX.maYIadrTaRb>...
>Sorry, I didn't read the whole message. Here's something else:
>
>> Dim insp As Variant
>> insp = elem.InsertionPoint 'Elem is a block and it is assigned a point
>> block_name = "C:\DRAWINGS\" & "VIRHE.DWG"
>> Set bl = AcS.activedocument.modelspace.InsertBlock(insp, block_name, 1#,
>1#, 0)
>
>insp should not be a variant, I get an error at this line (something like:
>byref argument not allowed). Declare an array of doubles, assign insp to it
>and pass this array to the insertblock function.
>
>Or just:
>
>> block_name = "C:\DRAWINGS\" & "VIRHE.DWG"
>> Set bl = AcS.activedocument.modelspace.InsertBlock(elem.InsertionPoint,
>block_name, 1#, 1#, 0)
>
>Hope this helps.
>
>Alain
>
0 Likes