SCOTTWHITTAKER2333
New Member
- Joined
- Jun 1, 2010
- Messages
- 32
Ok I have a Template workbook that has an auto save as macro that triggers on open. It creates the filename based on criteria entered into a few input boxes buy the user. The problem I am having is that there are many different templates that I have with a simmaler macro, and sometimes the "excel challanged"
users are opening the same template by mistake and creating the file more than one time. What I want to do is have the macro check to see if the file name exists in the directory before it completes the save as and if it does then display a message that the file has already been created. If possible I would also like it to close the template and open the file that was already created.
This is what my code looks like right now:

This is what my code looks like right now:
Code:
Private Sub Workbook_Open()
'
' saveasauto Macro
' Macro recorded 5/28/2010 by SCOTT.WHITTAKER '
'
If (Worksheets("Bowls").Range("R14") = "") Then
SKUa = InputBox("Enter the product number")
Shift = InputBox("Enter your shift:")
MeaName = Shift & "-" & SKUa & "-" & "-" & "Net wts" & Format(Now(), "mm-dd-yy") & ".xls"
ActiveWorkbook.SaveAs Filename:=Path & "\" & MeaName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False
Worksheets("Bowls").Range("R14") = SKUa
Worksheets("Bowls").Range("F1") = Shift
End If
End Sub