Returning to BricsCad from a VBA application

I've been trying to find the normal approach for doing this, but can't seem to find the right search terms or something.I have written a VBA application which creates a drawing based on user input on the VBA form. I run the VBA application by choosing the Run command from the VBA Editor. I've created a "Quit" button on my form, which stops the VBA application. However, it always returns me to the VBA editor.I have to goals; #1; I would like for the user form to stay on screen, but also allow for the user to continue to work directly on the drawing. #2; When the user is done with the VBA applicaiton, I would prefer the "quit" button to return the user to the drawing, and not the VBA editor.Joe Dunfee

Comments

  • Hallo Joe,sorry for my terrible English ... what I have understood is, that you start the VBA programm from the editor.Why don't you create for example a simple button in your toolboxes to run the program. Here an example for the command property in BricsCad V7: (command "_-vbarun" "NameOfYouSub")When you finish the program, the user shuld return to the drawing.Regards - Peter

  • Extremely simple dvb project holding one Form (UserForm1) and one Module ( Module1). The Form contains one textbox (TextBox1) and 2 buttons (cmdShowInfo, cmdQuit) All the sub main does is to display the form as a Modeless form Project HelloWorld.dvbUserForm1 - 1Option Explicit Sub UserForm_Initialize() Me.TextBox1.Text = " hello from VBA" End Sub Private Sub cmdQuit_Click() ThisDrawing.Activate Me.hide Unload Me End Sub Private Sub cmdShowInfo_Click() MsgBox "The active drawing is: " & ThisDrawing.Name End Sub Private Sub UserForm_Terminate() ThisDrawing.Activate Unload Me End SubModule1 - 1Option Explicit Sub main() UserForm1.Show (vbModeless) End Sub Supposing the project is loaded vbaload HelloWorld.dvb then you can launch itfrom the command line (or from a menu) with following Lisp command call: (command "_-vbarun" "HelloWorld.Module1.Main")

  • With respect to :#1; I would like for the user form to stay on screen, but also allow for the user to continue to work directly on the drawing. Forms in VBA are MODAL so once the take the focus, they keep it till u close the form.(Like in Excel) I've seen long ago on the Acad forum a posting about a 'dockable container' for VBA which would allow for modeless forms, but that all was pretty complicated.(For me at least)This was one of the reasons for me to go for VB6, which runs outside the CAD application and allows for users to work on the form and the drawing the same time.Maybe someone out there knows a clever trick to do this in VBA?Arno van Eeuwen

  • ok, I seem to have missed the posting of Ferdinand.;-)

  • Ferdinand, thank you VERY MUCH for your wondeful example.I had thought about a custom menu button (and perhaps several of them) but my current help file says "Not yet implemented" regarding customizing or creating new toolbars.Is my V8 help file out of date? Are you creating your custom button in V8?Joe DunfeeJoe Dunfee

  • Again, Ferdinand, your post was most helpful. This "showmodal" command is a bit confusing to understand, and the VBA help file doesn't help much.I added the followingn to my "quit" button ThisDrawing.Activate Unload Me End Sub Before I had simply put EndThen, I edited the properties of the userform so that Showmodal = FalseNow, I can keep the VBA program available and on screen, and also edit inside of BricsCad. When I quit the VBA application, I am returned to BricsCad. Everything works perfectly.Joe Dunfee

This discussion has been closed.