Creigbm
Mechanical
- Aug 1, 2003
- 161
Before upgrading to SW2005, I am creating a 'batch update' macro that will load all of the default templates using the following code:
It works great with one exception. The line that adds the swFileLocationsDocumentTemplates only adds the second folder, not the first as well. Is this a limitation that you cannot add multiple folders of templates using the SW API? I have tried doing something like "H:/fdsfs" & "H:/fsdf" and that doesnt work either.
Code:
Dim swApp As Object
Dim Part As Object
Dim retval As Integer
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
swApp.SetUserPreferenceStringValue swDefaultTemplateAssembly, "H:\SolidWorks\Standard Templates\Radial Assembly.asmdot"
swApp.SetUserPreferenceStringValue swDefaultTemplateDrawing, "H:\SolidWorks\Standard Templates\Drawing.drwdot"
swApp.SetUserPreferenceStringValue swDefaultTemplatePart, "H:\SolidWorks\Standard Templates\Radial Part.prtdot"
swApp.SetUserPreferenceStringValue swFileLocationsDocumentTemplates, "H:\SolidWorks\Standard Templates"
swApp.SetUserPreferenceStringValue swFileLocationsDocumentTemplates, "H:\SolidWorks\Skin Templates"
swApp.SetUserPreferenceStringValue swFileLocationsBOMTemplates, "H:\SolidWorks\BOM"
swApp.SetUserPreferenceStringValue swFileLocationsMacros, "H:\SolidWorks\Macros"
retval = MsgBox("Settings Update Complete ", vbExclamation, "Settings Wizard")
End Sub
It works great with one exception. The line that adds the swFileLocationsDocumentTemplates only adds the second folder, not the first as well. Is this a limitation that you cannot add multiple folders of templates using the SW API? I have tried doing something like "H:/fdsfs" & "H:/fsdf" and that doesnt work either.