I'm trying to write a program with a UserForm in SW VBA that allows me to add multiple components at once. AddComponent requires the component being added to be loaded into memory, so I am writing the code to work as follows:
Open part to be added
add the part
close part added.
The problem arises immediately on trying to open the document. Try as I might, I cannot get OpenDoc6 to work. here is the code:
Callout = "R:\" & TextBox1.Value & ".SLDPRT"
Set SWModel = swApp.OpenDoc6(Callout, 1, 0, "", 0, 0)
SWModel is declared as an object "Dim SWModel as Object"
Callout is a String.
The file exists.
Error is "Type Mismatch"
Thank you for your assistance.
SolidworksApi macros