Hello All, please assist us, the below macro does not delete the command button, where did we go wrong? thank you so much.
VBA Code:
Private Sub Copy_save()
Dim saveDate As Date
Dim saveTime As Variant
Dim formatDate As String
Dim backupFolder As String
Dim Sh As shapes
Const strFilePath As String = "C:\D Drive\"
saveDate = Date
formatDate = Format(Now(), "mmmm yyyy")
If MsgBox("You are now saying copy of this LineBooker Invoicing Workbook." & Chr(10) & _
"Do you want to proceed?", 36, "Transport (Pty) Ltd") = vbYes Then
Application.DisplayAlerts = False
backupFolder = ThisWorkbook.path & "\"
ActiveWorkbook.SaveCopyAs Filename:=backupFolder & Replace(ActiveWorkbook.Name, ".xlsm", "") & " " & formatDate & " " & formatTime & ".xlsm"
Application.DisplayAlerts = True
ActiveSheet.shapes("CommandButton1").Delete
'Sheets(Db).shapes("CommandButton1").Delete
MsgBox "You have successfully saved New Invoicing Workbook for LineBooker", 64, "Transport (Pty) Ltd"
End If
End Sub
Last edited by a moderator: