VBA - ActiveDocument.Close causing Inventor crash

VBA - ActiveDocument.Close causing Inventor crash

alewer
Advocate Advocate
1,345 Views
5 Replies
Message 1 of 6

VBA - ActiveDocument.Close causing Inventor crash

alewer
Advocate
Advocate
I'm creating a macro to run on creation of a new assembly from a particular template. I've read the help files and created a macro named autonew in the template's VBA project file. It works great except for one thing: if the user presses "Cancel" on my form, I want to not only unload the form but also close the file. For this case I've used:

ThisApplication.ActiveDocument.Close True

I've created a test template assembly with only this line in autonew, and it crashes Inventor. The same line of code an a non-autonew module within the template file's VBA project closes the document without error or crashing. I assume this is a bug and not as designed.

Is this a bad way to accomplish the task of closing a newly created assembly? Even if this isn't the preferred approach, I don't think this should cause a crash.

I'm running Inventor 2009 SP1.

Edit: I neglected to mention I'm running 64 bit on XP64 Edited by: alewer on Apr 22, 2009 10:15 AM
0 Likes
1,346 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
If I remember correctly, there is a new syntax for 64 bit code
that replaces the "ThisApplication.ActiveDocument" portion that
has something to do with the fact that VBA is 32 bit, and AD has
not yet incorporated VSTA instead (though VSTA has been around
almost 4 years?). A search here should turn up something. I would
at least start with that, then see if it still crashes.

Bob


alewer wrote:
> I'm creating a macro to run on creation of a new assembly from a
> particular template. I've read the help files and created a macro named
> autonew in the template's VBA project file. It works great except for
> one thing: if the user presses "Cancel" on my form, I want to not only
> unload the form but also close the file. For this case I've used:
> ThisApplication.ActiveDocument.Close True I've created a test template
> assembly with only this line in autonew, and it crashes Inventor. The
> same line of code an a non-autonew module within the template file's VBA
> project closes the document without error or crashing. I assume this is
> a bug and not as designed. Is this a bad way to accomplish the task of
> closing a newly created assembly? Even if this isn't the preferred
> approach, I don't think this should cause a crash. I'm running Inventor
> 2009 SP1. Edit: I neglected to mention I'm running 64 bit on XP64 Edited
> by: alewer on Apr 22, 2009 10:15 AM
0 Likes
Message 3 of 6

Anonymous
Not applicable
I have got the same problem
only i'm using XP and try to close the active document from visual studio
0 Likes
Message 4 of 6

alewer
Advocate
Advocate
I did get response from Autodesk after submitting quite a few crash reports. They've logged the issue, but gave no timeline for a fix. Make sure you are submitting the crash reports to "vote" for a fix. I've found no good workaround, so be sure to share if you find one.
0 Likes
Message 5 of 6

Anonymous
Not applicable
I found a very sleezy workaround but it's working for me because I'm using VB and not VBA.

instead of closing or quiting inventor (because both actions let inventor crash) I kill the inventor process
and for every drawing I have to reopen inventor.

greetings,

Simone
0 Likes
Message 6 of 6

Anonymous
Not applicable

Hi there,

 

Has there been any fixes or worksround around this issue anyone?

 

Inventor 2012 still crashes when using ActiveDocument.Close in iLogc rules.

 

Any help would be much appreaciated.

 

Regards,

Vas

0 Likes