pcollins
11-01-2007, 01:47 PM
Hi I have been trying to write some vba code that takes some data from various files, reformats it and then saves it as a *.csv file so that I can import it with a third party program. I have created this sub here and it seems to work fine except that it does not actually save the file, everything points to the file being saved, it even pops up a window saying the file was saved as XXXX.csv but the file is not there.
Anyone?
Sub CSV_Save()
YesNo = MsgBox("Do you wish to Save as a CSV File?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Text Files (*.csv), *.csv")
If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
ActiveWorkbook.SaveAs
End If
'Pause= MsgBox("There is still time to save, "Caution")
Case vbNo
pauseforuser = MsgBox("You may still save the file manually", vbOKOnly, "Caution!")
End Select
End Sub
Anyone?
Sub CSV_Save()
YesNo = MsgBox("Do you wish to Save as a CSV File?", vbYesNo + vbCritical, "Caution")
Select Case YesNo
Case vbYes
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Text Files (*.csv), *.csv")
If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
ActiveWorkbook.SaveAs
End If
'Pause= MsgBox("There is still time to save, "Caution")
Case vbNo
pauseforuser = MsgBox("You may still save the file manually", vbOKOnly, "Caution!")
End Select
End Sub