ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs not saving... (https://www.excelbanter.com/excel-programming/344254-saveas-not-saving.html)

JoePro82

SaveAs not saving...
 
I have the following code:

Private Sub CommandButton1_Click()
If OptionButton1 = True _
Or OptionButton2 = True _
Or OptionButton3 = True Then
'ok to save
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
Else
MsgBox "Please selecet a 'Project Status' before submitting!" &
vbLf & " FILE NOT SAVED!!"
End If
End Sub

It does everything right (i.e. opening the Save As dialog box or the
Message Box when required) up until the actual saving of the Workbook.
When I click "OK" the dialog box closes without saving, as if I had hit
"Cancel" instead. What am I missing? Thanks in advance for the help!!


Xcelion

SaveAs not saving...
 
Hi Joe,
You need to call Save or SaveAs method of the workbook object to save the
changes
Eg:
ActiveWorkBook.Save Changes:=True

Thanks
Xcelion




"JoePro82" wrote:

I have the following code:

Private Sub CommandButton1_Click()
If OptionButton1 = True _
Or OptionButton2 = True _
Or OptionButton3 = True Then
'ok to save
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
Else
MsgBox "Please selecet a 'Project Status' before submitting!" &
vbLf & " FILE NOT SAVED!!"
End If
End Sub

It does everything right (i.e. opening the Save As dialog box or the
Message Box when required) up until the actual saving of the Workbook.
When I click "OK" the dialog box closes without saving, as if I had hit
"Cancel" instead. What am I missing? Thanks in advance for the help!!



Norman Jones

SaveAs not saving...
 
Hi Joe,

The GetSaveAsFilename method merely returns the user's selection. You need
to save the file.

So, after the fileSaveName line, insert:

ThisWorkbook.SaveAs filesavename


---
Regards,
Norman



"JoePro82" wrote in message
oups.com...
I have the following code:

Private Sub CommandButton1_Click()
If OptionButton1 = True _
Or OptionButton2 = True _
Or OptionButton3 = True Then
'ok to save
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Microsoft Excel Workbook (*.xls), *.xls")
Else
MsgBox "Please selecet a 'Project Status' before submitting!" &
vbLf & " FILE NOT SAVED!!"
End If
End Sub

It does everything right (i.e. opening the Save As dialog box or the
Message Box when required) up until the actual saving of the Workbook.
When I click "OK" the dialog box closes without saving, as if I had hit
"Cancel" instead. What am I missing? Thanks in advance for the help!!





All times are GMT +1. The time now is 09:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com