View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
awrex awrex is offline
external usenet poster
 
Posts: 28
Default beforesave code working sometimes......

Ok I had posted a question about some code (Subject: Code issue -
before_save() - Filename with date stamp - worksheet), to which I got it to
work but now it is causing my Excel to completely crash.

Any ideas??? Also Why do I get 2 vbok pop up boxes????

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)


MsgBox "You should see something renamed!!", vbOK

Sheet1.Name = "As of " & Format(Now(), "MM-DD-YYYY")

ChDir "<new dir path"
ActiveWorkbook.SaveAs _
"<MyFileName" & Format(Now(), "yyyymmdd")

End Sub