Extensible CAD Technologies
SolidWorks and PDMWorks Enterprise Development Blog

CAD

GetObject( ) or CreateObject( )? Is there a difference? – Part I

Posted by at 4 October, 2007, 11:23 pm
3

Disclaimer: 99.9% of all the API programming I do these days is in .NET so for the times that I do answer a question incorrectly, 80% of the time it is a VBA (Visual Basic for Applications) question. Since most people start with VBA before they move on to .NET, however, I decided to cover this topic for VBA.

Set swApp = CreateObject(“SldWorks.Application”)

Almost all SolidWorks Macros start out with that same, famous line of code. In fact, whenever you record a Macro in SolidWorks, the SolidWorks Macro Recorder is kind enough to fill that line in for you. What does it really mean, though? And why do a few Macros begin instead with this line of code:

Set swApp = GetObject(,”SldWorks.Application”)

continue

If you enjoyed this post, make sure you subscribe to my RSS feed!

Category : CAD | Macros | MS Office | SolidWorks | SolidWorks API
Generate First-Article Inspection Reports From TIF, PDF and CAD Drawing Files With InspectionXpert. Generate First-Article Inspection Reports From SolidWorks Drawing Files With InspectionXpert.