2 Replies Latest reply on May 14, 2018 6:54 PM by William Miller

    Cycle through open drawings and print

    William Miller

      Hello all,

       

      I am trying to cycle through all my open drawings and print each one as it comes up. I was following along with some other code, but when I got to actually print the drawing, it just printed the same drawing over and over endlessly. Anyone have any ideas what could be happening? My code is below:

       

      Sub main()
      Dim swApp As SldWorks.SldWorks
      Dim swModel As SldWorks.ModelDoc2
          Set swApp = Application.SldWorks
          Set swModel = swApp.GetFirstDocument
          While Not swModel Is Nothing
              swModel.PrintDirect
              Set swModel = swModel.GetNext
          Wend
      End Sub