View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bill Oertell Bill Oertell is offline
external usenet poster
 
Posts: 11
Default Workbook_BeforeSave

I'm having trouble getting this code to work. The dialog box come up and
you can navigate to the directory you want, but the file still saves to the
original file name in the original directory.

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

a = MsgBox("Are sure you want to save this workbook?", vbYesNo)

If a = vbNo Then
Cancel = True
Else
SaveAsUI = True
fileSaveName = Application.GetSaveAsFilename("TCR" & Cells(20, 29) &
".xls", fileFilter:="Excel Files (*.xls),*.xls")
End If

End sub

What I want to do is force the user to save the file as TCR plus whatever is
in cell AC20, ie TCRSomeone.xls, but I'd like them to be able to save it in
the directory they choose.