Hi everyone.
I am having some issues saving design tables and reopening them. I have created a simple user form in a main excel file that updates the design table of every part, by that i mean it adds new configurations and dimensions. For it to work I need to open every excel file separately, update it and save it. Then I can open every part and new configurations are added.
I wanted to speed up the process, so I have created a simple VBA macro that opens every design table as an excel file, updates and closes it. That part works fine.
After updating every design table I open the parts, new configurations are added and everything works fine. The next step is where I am experiencing issues.
After closing the parts, the design tables are saved from SolidWorks. When I try to open them in excel after I get the following error:
Here is the VBA macro:
Option Explicit
Sub update_tablica()
Dim strFilepath As String
Dim strFilename(2) As String
Dim i As Integer
strFilepath = "C:\\Users\\dcica\\Desktop\\Stol\\"
strFilename(0) = "Gornja ploča"
strFilename(1) = "Konstrukcija"
strFilename(2) = "Stol"
For i = 0 To 2
- Workbooks.Open (strFilepath & strFilename(i))
- Application.DisplayAlerts = False
Workbooks(strFilename(i)).SaveAs filename:=strFilepath & strFilename(i) & ".xlsx", FileFormat:=51
Workbooks(strFilename(i)).Close
Next i
End Sub
SolidworksApi macros