save as filename

  • Thread starter Thread starter Geo Siggy
  • Start date Start date
G

Geo Siggy

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
 
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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Save As macro 2
SAVE AS MACRO 4
SAVE AS MACRO 5
SAVE AS MACRO 6
Get Filename without the extension 9
GetSaveAsFileName questions 2
Help on GetSaveas Filename 2
File name being changed 2

Back
Top