ErinJ
New Member
- Joined
- May 27, 2011
- Messages
- 26
I have the following code:
It works great if user goes to file/saveas.
BUT if user goes directly to save it crashes excel (Microsoft Excel has stopped working....trying to recover....closing excel.....reopens in recover mode)
Any thoughts
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.DisplayAlerts = False
Dim StrPath
Select Case Range("M5").Value
Case ""
StrPath = "S:\Approved blank admin forms\"
Case "Tommy"
StrPath = "Z:\"
Case "Brad"
StrPath = "X:\"
Case "Erin"
StrPath = "V:\JobCost\"
Case "Blake"
StrPath = "U:\"
Case "Cody"
StrPath = "T:\"
Case "Eric"
StrPath = "R:\"
Case Else
End Select
ActiveWorkbook.SaveAs Filename:=StrPath & Sheet1.Range("G8") & ".xls"
Application.DisplayAlerts = True
Range("D5:G5").Select
End Sub
BUT if user goes directly to save it crashes excel (Microsoft Excel has stopped working....trying to recover....closing excel.....reopens in recover mode)
Any thoughts