Hey all,
I have a sub routine thats crashing 2007 every single time like clockwork, but never crashed 2003.
Is there anything in this that would tank 2007????
Sub ForceSave()
Dim FileName As String
Dim FilePath As String
Dim WB As Workbook
Select Case Range("cboProperty_Index")
Case Is < 2
MsgBox "Please select a Property from the dropdown list.", vbInformation, "Required Value"
Exit Sub
End Select
Application.ScreenUpdating = False
Set WB = ActiveWorkbook
FileName = "Lease Renewals(" & Range("month") & "-" & Range("year") & ")-" & _
Range("PropShortName") & "_" & Format(Now(), "m.d.yyyy_hhmmAMPM") & ".xlsm"
FilePath = "\\File01\shared\IAMC\Properties\" & Range("SaveFolder") & "\Renewals\" & _
Range("month") & "-" & Range("year") & "\"
On Error Resume Next
Kill "U:\" & FileName
On Error GoTo 0
If Dir(FilePath, vbDirectory) = vbNullString Then
On Error GoTo Error_Msg
MkDir (FilePath)
On Error GoTo 0
End If
On Error GoTo Error_Msg
If Dir(FilePath & FileName) = vbNullString Then
WB.SaveAs FileName:=FilePath & FileName, FileFormat:=52
Else
Application.DisplayAlerts = False
WB.SaveAs FileName:=FilePath & FileName, FileFormat:=52
Application.DisplayAlerts = True
End If
On Error GoTo 0
On Error Resume Next
With Sheets("Splash")
.Shapes("btnSubmit").Cut
.Visible = False
End With
On Error GoTo 0
If FilePath & FileName = vbNullString Then
WB.SaveAs FileName:=FilePath & FileName, FileFormat:=52
Else
Application.DisplayAlerts = False
WB.SaveAs FileName:=FilePath & FileName, FileFormat:=52
Application.DisplayAlerts = True
End If
Workbooks.Open FileName:=FilePath & FileName
ThisWorkbook.Activate
WB.Close SaveChanges:=False
Application.ScreenUpdating = True
Exit Sub
Error_Msg:
MsgBox "You do not have sufficient priveledges to save this file.", vbCritical, "File Path Error"
Exit Sub
End Sub
Bookmarks