Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default save as filename

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

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to save file as different filename mac Excel Worksheet Functions 6 November 21st 07 10:43 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
Save as .htm with filename from cell galimi Excel Discussion (Misc queries) 1 May 13th 05 04:51 AM
Save date in filename Mike Excel Programming 6 February 24th 04 02:12 PM
Disabling Macros After A Save To A Different Filename R3df1sh[_2_] Excel Programming 2 November 14th 03 12:00 PM


All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"