5 Replies Latest reply on Feb 15, 2017 4:39 PM by Keith Rice

    2016 clear memory cache so files can be moved

    Aaron Conner

      When I close the file in Solidworks I need to be able to move it in windows.  I created a macro in 2015 that closed the current file and opened up a random file (simple square block) thus clearing the memory.  Anyways, now we are in 2016 and that no longer works.  Any ideas on how to fix this would be great.  Thanks,

       

      p.s.  Here's what the macro was.

       

      ' ******************************************************************************
      ' C:\Users\aconner\AppData\Local\Temp\swx3920\Macro1.swb - macro recorded on 02/26/15 by aconner
      ' ******************************************************************************
      '  Pre-condition:  Files need to be opened
      '  Post-condition:  All files excluding unsaved files with be closed and memory of already saved files erased.

      Dim swApp As Object

      Dim Part As Object
      Dim boolstatus As Boolean
      Dim longstatus As Long, longwarnings As Long

      Sub main()

      Set swApp = _
      Application.SldWorks

      ' If IncludeUnsaved is False, then all documents, excluding any unsaved documents, are closed

          boolstatus = swApp.CloseAllDocuments(False)

          Debug.Print boolstatus

      Set Part = swApp.OpenDoc6("S:\Checkable\62C-ORG\Part4.SLDPRT", 1, 0, "", longstatus, longwarnings)
      swApp.ActivateDoc2 "Part4.SLDPRT", False, longstatus

      Set Part = swApp.ActiveDoc
      Dim myModelView As Object
      Set myModelView = Part.ActiveView
      myModelView.FrameLeft = 0
      myModelView.FrameTop = 0
      Set myModelView = Part.ActiveView
      myModelView.FrameState = swWindowState_e.swWindowMaximized
      Set myModelView = Part.ActiveView
      myModelView.FrameState = swWindowState_e.swWindowMaximized

      Set Part = swApp.ActiveDoc
      Set Part = Nothing
      swApp.CloseDoc "Part4.SLDPRT"

      End Sub