Hi - im new to the solidworks api but fairly familliar with VBA in general - one way i try to develop code is take macros/API code examples from SW and copy the code into the Access code windows. works marvellously normally on different apps but with SW i keep getting errors. I presume its to do with not having the right references set in Access 2007.
For example most examples i come across in the help files, after declaring variabes ,start something like
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
I have to change "Set swApp = Application.SldWorks" to "Set swApp = GetObject(, "SldWorks.Application")" to get anything to run and doing this i can get some examples to work
"Set swDraw = swModel" just dosent want to behave no matter what i do........
I appreciate most of my problem is simply down to my lack of knowledge re SW API and its structure but this is driving me insane - anyone got any ideas.
The current references ive got set are:
Solidworks extensibility type library
SldWorks 2011 Type Library
SolidWork 2011 Constant type library
Solidworks 2011 commands type library
Is it an order thing ? am i missing some ? got one i shouldnt ?- i can see the API being a great help to us but getting off the ground with it is proving a tad annoying.
As far as im aware these references should be the same in excel- has anybody successfully got that "Set swDraw = swModel" line working in a spreadsheet VBA function ?
Thanks
SolidworksApi macros