BradleyS
Active Member
- Joined
- Oct 28, 2006
- Messages
- 351
- Office Version
- 2010
- Platform
- Windows
Hi
I have a workbook with a macro, but I don't want the workbook overwritten.
Therefore if I press the save button OR close the workbook I always want it to Save As a CSV file format
Ideally I want to show the Save As dialog screen and prefix it with the my default file name.
I have added the code below to BeforeSave and BeforeClose, but I can't get it to work as mentioned above
Dim newFile As String, fName As String
gName = "FGM_"
fName = Range("A2").Value
newFile = gName & " " & fName & " " & Format$(Date, "dd-mm-yyyy")
Dim fileSaveName As Variant
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=newFile, FileFilter:="CSV (Comma delimited) (*.csv), *.csv", Title:="Save As")
I have a workbook with a macro, but I don't want the workbook overwritten.
Therefore if I press the save button OR close the workbook I always want it to Save As a CSV file format
Ideally I want to show the Save As dialog screen and prefix it with the my default file name.
I have added the code below to BeforeSave and BeforeClose, but I can't get it to work as mentioned above
Dim newFile As String, fName As String
gName = "FGM_"
fName = Range("A2").Value
newFile = gName & " " & fName & " " & Format$(Date, "dd-mm-yyyy")
Dim fileSaveName As Variant
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=newFile, FileFilter:="CSV (Comma delimited) (*.csv), *.csv", Title:="Save As")