A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Try this:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Myname As String, Mypath As String
Dim a As Long
On Error Goto ErrorHandler
Application.EnableEvents = False
Myname = Application.ActiveWorkbook.Name
Mypath = "J:\Apg\Proposals\Resource Input"
a = MsgBox("Do you really want to save the workbook?", vbYesNo)
Cancel = True
If a = vbYes Then
Application.DisplayAlerts = False
Application.ActiveWorkbook.SaveAs (Mypath & Myname)
Application.DisplayAlerts = True
End If
ErrorHandler:
Application.EnableEvents = True
End Sub
Your "Application.ActiveWorkbook.SaveAs (Mypath & Myname)" causes the BeforeSave event to fire, whichis why you see it twice. Disable events with Application.EnableEvents = False at the start and re-enable at the end.
Hope that helps.
Cheers
Rich