Hi

At the point, where I have the swApp.opendoc6, VB says 'Argument not optional' - what am I making wrong this time?
VB Code:
  1. Private Sub cmdExcel_Click()
  2. Dim swApp As Object
  3. Dim AppEx As Object
  4. Dim SWModel As SldWorks.ModelDoc2
  5. Dim WB As Object
  6. Dim x As Integer
  7.  
  8. Set swApp = CreateObject("SldWorks.Application")
  9. Set AppEx = CreateObject("Excel.Application")
  10. Set SWModel = swApp.ActiveDoc
  11. x = 2
  12. Do While Files.FileName <> ""
  13. swApp.ActiveDoc.ActiveView.FrameState = 1
  14. Set SWModel = swApp.OpenDoc6(Files.Path & "\" & Files.FileName)
  15. Set WB = GetObject(, "Excel.Application")
  16. Set SWModel = swApp.ActivateDoc(Files.FileName)
  17.  
  18. WB.Cells(x, 1).Value = SWModel.GetPathName
  19. WB.Cells(x, 2).Value = SWModel.CustomInfo("tegnnr")
  20. WB.Cells(x, 3).Value = SWModel.CustomInfo("ktegnr")
  21.  
  22. WB.Cells(x, 12).Value = SWModel.CustomInfo("rev")
  23. x = x + 1
  24. Loop
  25. End Sub