10 Replies Latest reply on Jun 3, 2014 3:23 PM by Wayne Estes

    Border Replace in Drawing

    Wayne Estes

      Trying to set up a macro to replace an exsiting border with an updated version. I recordered this macro and when I run it the existing border stays and new one overlays on top of it. It also changes the sheet name to sheet5 as that was the page I was on when I created the macro. This is my first attempt to create a macro.

       

      What I would like it to do is run the macro and have it replace all border pages in a drawing with the new one, "carco b-size".

       

      Then how do I make an icon or set the macro to a hot key?

       

      Thanks for any help.

       

       

      Sub main()

      Set swApp = _
      Application.SldWorks

      Set Part = swApp.ActiveDoc
      Dim myModelView As Object
      Set myModelView = Part.ActiveView
      myModelView.FrameState = swWindowState_e.swWindowMaximized
      boolstatus = Part.Extension.SelectByID2("Sheet5", "SHEET", 0.320689709179794, 0.103595823088456, 0, False, 0, Nothing, 0)
      Part.ClearSelection2 True
      boolstatus = Part.SetupSheet5("Sheet5", 12, 12, 1, 24, False, "l:\solidworks templates\carco b-size.slddrt", 0.4318, 0.2794, "Default", False)
      End Sub