ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   save as filename (https://www.excelbanter.com/excel-programming/294254-save-filename.html)

Geo Siggy[_14_]

save as filename
 
Hi,

I like to save a file before closing. The user may choose a free nam
for saving. by changing the original given name in the save menu.

With the following code the file will be saved with the original name
even if the user change the original name to a new name in the sav
menu. Whats wrong with the code ?

The code:

Dim abcsave As Variant
abcsave = ActiveWorkbook.Name
abcsave = Application.GetSaveAsFilename(, "Excel file
(*.xls),*.xls")
If abcsave = False Then
Exit Sub
Else
ActiveWorkbook.Save
End If
Hide
ActiveWorkbook.Close SaveChanges:=False

Any idea ?. Thanks. Sigg

--
Message posted from http://www.ExcelForum.com


Rob van Gelder[_4_]

save as filename
 
abcsave is not used after you've got it from GetSaveAsFilename.

GetSaveAsFilename only retrieves the name as a string. It is up to you to
use that string for saving.

I suggest you change
ActiveWorkbook.Save
to
ActiveWorkbook.SaveAs abcsave


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Geo Siggy " wrote in message
...
Hi,

I like to save a file before closing. The user may choose a free name
for saving. by changing the original given name in the save menu.

With the following code the file will be saved with the original name,
even if the user change the original name to a new name in the save
menu. Whats wrong with the code ?

The code:

Dim abcsave As Variant
abcsave = ActiveWorkbook.Name
abcsave = Application.GetSaveAsFilename(, "Excel files
(*.xls),*.xls")
If abcsave = False Then
Exit Sub
Else
ActiveWorkbook.Save
End If
Hide
ActiveWorkbook.Close SaveChanges:=False

Any idea ?. Thanks. Siggy


---
Message posted from http://www.ExcelForum.com/




Bob Phillips[_6_]

save as filename
 
Dim abcsave As Variant
abcsave = ActiveWorkbook.Name
abcsave = Application.GetSaveAsFilename(, "Excel files
(*.xls),*.xls")
If abcsave = False Then
Exit Sub
Else
ActiveWorkbook.SaveAs Filename:=abcsave
End If
Hide
ActiveWorkbook.Close SaveChanges:=False


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Geo Siggy " wrote in message
...
Hi,

I like to save a file before closing. The user may choose a free name
for saving. by changing the original given name in the save menu.

With the following code the file will be saved with the original name,
even if the user change the original name to a new name in the save
menu. Whats wrong with the code ?

The code:

Dim abcsave As Variant
abcsave = ActiveWorkbook.Name
abcsave = Application.GetSaveAsFilename(, "Excel files
(*.xls),*.xls")
If abcsave = False Then
Exit Sub
Else
ActiveWorkbook.Save
End If
Hide
ActiveWorkbook.Close SaveChanges:=False

Any idea ?. Thanks. Siggy


---
Message posted from http://www.ExcelForum.com/




Geo Siggy[_15_]

save as filename
 
ok, thanks
I forgot to give the filename again ...
Sigg

--
Message posted from http://www.ExcelForum.com



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

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