SolidWorks uses VBA for its macros, but it is very different than Excel VBA (which is what I'm accustomed to). They made it very difficult (and quite possibly impossible) to manipulate strings in SW. I've tried using the Left() function and the Mid() function, but I can not figure out how to make it work. Basically what I need it to do, is a Save As .DXF file and name it the title, but WITHOUT the sheet name. The sheet name is causing the problem and I'm trying to cut it out. I can use
Part.GetTitle
to get the string of the title which, for example is something like
PA0000 - Sheet1
and I just want it to be
PA0000
Sometimes the length is different, so I've tried using
Left(Part.GetTitle,Instr(Part.GetTitle, " ")-1)
but it gives a Type Mismatch error. What am I doing wrong? All that's left for this macro is to cut out the " - Sheet1".
longname = Len(Part.GetTitle) - 9
' Save As longstatus = Part.SaveAs3(Left(Part.GetTitle, longname) + ".SLDDRW", 0, 2)
so the full code is: