VBA - Insert an array control into a property manager

Hello

 

I'm creating a PropertyManager in a VB macro, I'd  like to insert a control identical to the one of the Helix/Spiral function (the P/Rev/H/Dia array), is this possible?.

 

Thank you


property_manager.jpg

Hello

 

What do you mean by creating a PropertyManager?

 

I think it's impossible to have a table of this type by a macro.

 

The only possible solution would be to use an external Excel (or .csv) spreadsheet.

Hello

I haven't created a property manager for my macros yet.

I can't answer you like that, I'll look at what can be done.

This is the panel that is displayed when you create/modify a function, with VB you can create a property manager including text boxes, drop-down lists, etc... as in this example

Create PropertyManager Page With Many Controls Example (VBA)

 

I think the control I want exists using an activex control or in a library but I don't know which one.

 


macro_property_manager.jpg

In the SolidWorks help about this, he details the list of available ones:

http://goo.gl/lmZd7u

 

What is available?

The SolidWorks API provides:

See Controls on Multipage PropertyManager Page for details about programming controls on a multipage PropertyManager page.

 

So indeed it must go through an ActiveX.

 

To start: http://msdn.microsoft.com/en-us/library/aa751972%28v=vs.85%29.aspx

 

To wrap an Excel file in ActiveX:

http://stackoverflow.com/questions/224044/need-activex-control-to-embed-excel-into-a-dialog

 

If you already know ActiveX, it shouldn't be too much of a problem! Good luck!

1 Like

I found the same information as Lucas in the help.

For the ActiveX controls I couldn't help you.

Good luck and keep us informed.

Hello

 

This is not possible with standard SolidWorks controls

 

The easiest way is to create a .net addins and create the array in a UserControl with the standard .Net controls.

 

Then, to add it back to the PPM, your userControl uses the AddControl Method API (IPropertyManagerPage2) with a swControlType_WindowFromHandle type.

 

You will just have to instantiate your Usercontroler and pass your Handler with this code:

 

ocontrol. SetWindowHandle(oUserControl.Handle.ToInt64())

 

and your userControl .Net will appear in your PMP.

 

A+

 

Philippe

4 Likes

Hello 

 

There's an example in the API Help

search for "Create PropertyManager Page With Many Controls Example (VBA)"

 

To see the example of activeX with the MSACAL control . Calendar by micirsoft

 

 

7 Likes

I'll have to get started with .Net, the problem is that I only have VB. I'll find another way

Thank you prossignol

 

1 Like

Hello jfaradon

I had seen the example, I was looking for the same thing with an excel table instead of the calendar.

I just started a tutorial on the .NET. y.pacquelet !

I reassure you, it's very close to the VB!

Visual Studio Express is free (I don't know the difference with the paid version), you have to download the Windows Desktop version.

 

Here is the tutorial:

http://fr.openclassrooms.com/informatique/cours/apprenez-a-programmer-en-vb-net

1 Like

Hello

 

Attached is an example of VB.net addins of the SolidWorks SDK with a sample PMP.

 

A+

 

Philippe


swvbaddin1.zip
6 Likes

Thank you all for your answers, I'll look into it.