View Full Version : VBA - Change User Focus From Form to AutoCAD Window
bsardeson
2011-02-14, 06:25 PM
From a VBA Form I automate AutoCAD 2000 to create some architectural roof structures, like trusses, walls, fascia boards, etc.
Once the automated portion is complete, how do I return user control from the VBA Form to AutoCAD so the user can finish detailing the drawing for items outside the scope of the automation or to review the finished product of the automation?
Once the user is complete with the original automation output, if unsatisfied, I would like to return the user control back to the VBA Form so the user can modify the automation inputs and create a new drawing.
Using VBA, is this possible and how would I do this? I know it is possible with VB6.
arshiel88
2011-02-15, 11:29 AM
Have you tried simply hiding the form?
ie. Me.hide instead of Unload(Me)
Then create a toolbar button with macro
^C^C_vbastmt;anyFormName.show; and it will show the previous state of the form before hide.
bsardeson
2011-02-15, 07:24 PM
Have you tried simply hiding the form?
ie. Me.hide instead of Unload(Me)
Then create a toolbar button with macro
^C^C_vbastmt;anyFormName.show; and it will show the previous state of the form before hide.
Isn't working, the in-code .hide hides the form, but the toolbar button is attempting to launch a new instance of the form, not SHOW the existing form.
arshiel88
2011-02-15, 08:43 PM
It works as expected on my side. I'm using AutoCAD 2008 on Windows XP SP3. Whats yours?
Try testing it on something simple. I have tested it on a form with only a textbox, showed the form. Typed something. Then hid it. showed again and the textbox still contains what I typed.
And, don't click the close (x) button of the form. It works the same as the Unload statement.
Or, maybe you don't need to hide the form, in that case you can use frmAnyFormName.show vbModeless to enable the user to switch focus to the drawing area and work while the form is still on.
bsardeson
2011-02-16, 01:47 PM
It works as expected on my side. I'm using AutoCAD 2008 on Windows XP SP3. Whats yours?
I'm using AutoCAD 2000 - Essentially, it's VBA 5, not VBA 6 ... which was introduced in AutoCAD 2002. vbModeless is not a valid parameter in VBA 5.
Apparently, the solution is use a newer AutoCAD version or switch to pure VB6 and make my application an external app.
Thanks for your assistance anyway.
Ed Jobe
2011-02-16, 10:56 PM
If I remember right, there was a control you could add to your project to get a modeless window. Search the forum for accont.arx. If not I'll see if I still have it laying around.
bsardeson
2011-02-21, 01:56 PM
If I remember right, there was a control you could add to your project to get a modeless window. Search the forum for accont.arx. If not I'll see if I still have it laying around.
Search turns up nothing in AUGI, Autopdesk or Google .. .a few people mention account.arx but there are no replies. :(
Ed Jobe
2011-02-22, 04:37 PM
Search turns up nothing in AUGI, Autopdesk or Google .. .a few people mention account.arx but there are no replies. :(
Here it is. Not sure if its the right version for 2000 though. See if it'll load.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.