progeCAD support, tips and troubleshooting forum. progeCAD works very similar to some versions of AutoCAD. Moderated.

Moderators: caddit, Moderators

#2382 by ferdiedr
Wed Jul 19, 2017 7:54 am
Hi caddit,

I'm trying to create a custom button that runs a VBA program I've written, but I only got as far as opening the 'Run progeCad VBA Macro' menu (^C^C^C_vbarun).

From there I've got to select 'Macros in: CommonProjects' and then select the macro 'Module1.main'.

Is there a button command that could go directly to the Module1.main?

Even if there isn't, I'd appreciate a reply telling me there's not.

Thanks in advance
#2383 by jouni
Fri Aug 04, 2017 6:22 am
Hello

In Progecad2014 it goes like this:

1. You need a lisp program for loading your application. It is named as MyAppLoad.lsp. Your app is named as MyApp. You can change the name and location.
---
(setvar "cmdecho" 0)
(command "-vbaload" "C:\\MyApp\\MyApp.vbi")
(setvar "cmdecho" 1)
(princ"\nAppLoaded!\n")
(princ)
---
2. then you need a menu file for the button. Save and name it MyApp.mnu
---
***MENUGROUP=MyApp

***TOOLBARS
**MyApp
ID_toolbar_name [_Toolbar ("MyApp", floating, show, 200, 200, 1)]
ID_button_name [_Button ("MyApp", MyApp_button, MyApp_button)]^C^C(load"MyAppLoad");^C^C^C-vbarun;"MyApp";

***HELPSTRINGS
ID_button_name ["MyApp Start"]
---
3. And you need a button picture file (bmp). You can draw it with Paint or similar. The size is 16x16 pixels. Name it MyApp_button.bmp.

4. Setup

Tools->Customize->Menu and Toolbars. Import *.mnu file. Select Append to existing toolbars. Find MyApp.mnu.

Then lisp-file. Tools->Load lisp or SDS Application. Add File. Find MyAppLoad.lsp. Load.

5. Now you should find your button on the screen. You can drag it to the toolbar area. In PC2017 there is a different way to build buttons.

6. if you need a menu file (icm) here it is:
---
[IntelliCAD Custom Menu File]
nMenuItems=2
[MnuItem-1000]
Name=MyApp
Visibility=12
[MnuItem-1001]
Name=MyApp
Command=^C^C(load"MyAppLoad");^C^C^C-vbarun;"MyApp";
Visibility=12
SubLevel=1
---
Name it MyApp_menu.icm. Import it Tools->Customize->Menu, Import, remember append
#2384 by ferdiedr
Sat Aug 05, 2017 2:48 am
Hi Jouni,

Thank you very much for that.
I didn't realize it was such a big task, but I'm certainly going to give it a go.

Thank you for your time and effort.

many regards,
Ferdie