AnsweredAssumed Answered

VBA Clear the copy from clipboard

Question asked by James Dickson on Mar 31, 2020
Latest reply on Mar 31, 2020 by Josh Brady

I have a macro that will copy the notes from the format sheet and paste them on the front sheet. Everything works great except I cant figure out how to clear the copied notes from the clipboard. If I run the macro again and there are no notes on the format sheet it will paste the note from the last notes copied. 

 

Is there a way to clear the copy clipboard or if there are no notes then do skip the paste.

 

Part of the code below. Thanks for any help you can give.

 

 

Private Sub CommandButton_Move_Notes_Click()

Dim swApp As Object

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

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc


If Update_Format.ComboBoxCurrentSheetSize.Value = "" Then

MsgBox "Select Currnt Sheet Size Before Performing Action"

Else

If Update_Format.ComboBoxCurrentSheetSize.Value = "DONE" Then

MsgBox "Select A New Currnt Sheet Size Before Performing Action"

Else

If Update_Format.ComboBoxCurrentSheetSize.Value = "B" Then

boolstatus = Part.Extension.SelectByID2(" A", "SHEET", 0.104339414046694, 0.175981350443167, 0, False, 0, Nothing, 0)

Part.EditTemplate
Part.EditSketch
Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("Sheet Format1", "SHEET", 0.138783928127944, 8.60099041792129E-02, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SketchBoxSelect("0.138784", "0.086010", "0.000000", "0.009617", "0.262687", "0.000000")

Part.EditCopy
Part.EditDelete

boolstatus = Part.Extension.SelectByID2("Sheet Format1", "SHEET", 9.61700032325701E-03, 0.262686506578727, 0, False, 0, Nothing, 0)

Part.EditSheet
Part.EditSketch
Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2(" A", "SHEET", 1.11016776543454E-02, 0.261201829247639, 0, False, 0, Nothing, 0)

Part.Paste

Part.ClearSelection2 True

ComboBoxCurrentSheetSize.Value = "DONE"

End If

 

End Sub

Outcomes