Hi, I have a question.... Im developing a cash reconciliation whereby a user saves a template into a directory... I have a Coversheet tab in this workbook where they select from a drop down box the following:

1) operator
2) month
3) the year

then the following code Creates a NEW workbook in the same directory and renames the workbook:

Cash Reconciliation " & oprtr$ & " " & mnth$ & " " & yr$

OK..... All good until a user in the following month selects the same:

1) operator
2) month
3) the year

as the month before... excel prompts the user if they want to overwrite the previously file.. if they accidently select YES.. then the file is overwritten..... What is the code and where do I put it if I want excel to prevent overwriting the file... perhaps to check in the directory if there is the same file, then prompt the user to SELECT A DIFFERENT:

1) operator
2) month
3) the year

Any other ideas???? the whole purpose is to prevent the user from overwriting the previously created file which may have data in it.....

I know it may be tricky so im hoping all you genious's can help me out here... thankyou heaps...

here is the code i got for saving the workbook but it doesnt work:






[vba]
Private Sub CommandButton1_Click()
Dim wbpath$, oprtr$, mnth$, yr$
Dim Sht As Worksheet
' name new workbook according to file path to which original was saved
' and add Operator, Month, and Year to name
Application.ScreenUpdating = False
If Range("f24") = "-" Then
MsgBox "Operator name must be entered"
Exit Sub
End If
If Range("f26") = "-" Then
MsgBox "Month must be entered"
Exit Sub
End If
If Range("f27") = "-" Then
MsgBox "Year must be entered"
Exit Sub
End If
With Sheets("cover sheet")
oprtr$ = .Range("f24")
mnth$ = .Range("f26")
yr$ = .Range("f27")
End With
Sheets("Cover Sheet").Shapes("CommandButton1").Delete
For Each Sht In ActiveWorkbook.Worksheets
If Sht.Name <> "Cover Sheet" Then Sht.Visible = True
Next
Application.Run "rename_sheets"
Application.Run "hidefirstlast"
Dim fn As String
fn = Dir(ActiveWorkbook.Path & "\Cash Reconciliation " & oprts$ & _
" " & mnth$ & " " & yr$ & ".xls")
If Len(fn) Then
MsgBox "File already exists"
Exit Sub
End If
ThisWorkbook.SaveAs Application.ActiveWorkbook.Path & "\Cash Reconciliation " & _
oprtr$ & " " & mnth$ & " " & yr$ & ".xls"
Application.ScreenUpdating = True

If Range("f26") = "April" Then
Sheet36.Visible = False
Sheet1.Range("40:40").EntireRow.Hidden = True
End If
If Range("f26") = "June" Then
Sheet36.Visible = False
Sheet1.Range("40:40").EntireRow.Hidden = True
End If
If Range("f26") = "September" Then
Sheet36.Visible = False
Sheet1.Range("40:40").EntireRow.Hidden = True
End If
If Range("f26") = "November" Then
Sheet36.Visible = False
Sheet1.Range("40:40").EntireRow.Hidden = True
End If
If Range("f26") = "February" Then
Sheet36.Visible = False
Sheet35.Visible = False
Sheet1.Range("39:40").EntireRow.Hidden = True
End If

End Sub

[/vba]