Okay, I am building an Excel 2010 spreadsheet for use as a SharePoint library template. The following VBA code is in the ThisWorkbook object.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Sheet1").Range("H2").Value = "[Select]" Then
MsgBox "You must make a selection for On-Call Week Length (H2)."
Cancel = True
End If
If Worksheets("Sheet1").Range("AA2").Value = "[Type Name Here]" Then
MsgBox "You must type your name in the Employee field (AA2)."
Cancel = True
End If
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveSheet.Range("A2").Value = ActiveSheet.Range("A2").Value
Dim SharePointPath As String
SharePointPath = "<PATH>"
Application.EnableEvents = False
ThisWorkbook.SaveAs Filename:=SharePointPath & "/" & Format([A2], "mm-dd-yyyy") & ".xlsm", FileFormat:=52
Cancel = True
Application.EnableEvents = True
End Sub
Can I save the workbook without the scripts running, but so they will run the next time the workbook is opened via the SharePoint library?
Bookmarks