-
Re: VBA in solidworks with "UserForm"
Ivana Kolin Aug 21, 2015 4:23 PM (in response to Magnus Ivarsson)And by the way increase view on your YouTube video
-
Re: VBA in solidworks with "UserForm"
Josh Brady Aug 21, 2015 5:11 PM (in response to Magnus Ivarsson)Magnus,
Maybe nobody is doing it because nobody understands the value. What is the point of this macro? To draw a square is trivial. What do you want to do with the macro? I doubt anybody except you will ever care about this macro. It's not challenging in any way. It does not show special capability. It is not interesting. It can't do a useful task for anyone. It's hard to get people to do things for you for free when they are none of those things.
-
Re: VBA in solidworks with "UserForm"
Magnus Ivarsson Aug 21, 2015 5:33 PM (in response to Josh Brady)-
I need to write in a few values and then code the VBA to draw 2D and 3D drawings.
I did it in AutoCad with "UserForm" as in the video, but I can not get the "UserForm" in SolidWorks 2009 to appear.
How do I get the "UserForm" to appear in SolidWorks so I can do the same in SolidWorks as in the video?
To get the "UserForm" to appear is probably something to install with the installation of SolidWorks.
This is not a trivial question.
Regards
-
Re: VBA in solidworks with "UserForm"
Josh Brady Aug 25, 2015 9:47 AM (in response to Magnus Ivarsson)It is indeed utterly trivial. There are multiple examples available online to show how to use UserForms in SolidWorks VBA macros.
Attached is your macro.
To run the macro, first you must have a part, assembly, or drawing file open.
Then, point to Tools→Macro→Run. Browse to where you have saved the attached .swp file. Select it, and hit "Open".
-
Macro1.swp.zip 7.4 KB
-
-
Re: VBA in solidworks with "UserForm"
Chris Champions Aug 26, 2015 12:49 PM (in response to Magnus Ivarsson)it's totally basic to show userform in SW- I think you need to learn some visual basic before start writing SW macro
Here is the code
Dim swApp As Object
Sub main()Set swApp = Application.SldWorks
UserForm1.ShowEnd Sub
-
-