Making a File Go to SaveAs On Open

  • Thread starter Thread starter DoctorV
  • Start date Start date
D

DoctorV

I just wanted to know if there was a way that as soon as an Excel Fil
was opened it immediately went to File SaveAs so the user was forced t
give it a new name. Thank
 
One way:

Put this in the ThisWorkbook code module (right click the workbook
titlebar and choose View Code):

Private Sub Workbook_Open()
Dim sFileName As Variant
Dim bSame As Boolean
Do
If bSame Then MsgBox "Filename must be different"
sFileName = Application.GetSaveAsFilename
bSame = sFileName = ThisWorkbook.FullName
Loop While bSame Or sFileName = False
ThisWorkbook.SaveAs sFileName
End Sub
 
Thanks JE One question Is there any way the Save As File Name in th
Dialog Box can display without the Double Quotes after the .xls
Currently when I open the file it shows up as "A_FILE.xls". I don'
mind if the preceding " is there but I would be afraid that the user
might not clean up the triling
 
One other thing. Is there any way to delet the On Workboo Open Cod
after the file has been saved to a new name because I don't want th
user to be prompted to save to a new name off the template more tha
once
 
Back
Top