#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 75
Default file won't save!

Any idea why this line of code won't save the file?? The "Save AS" box comes
up the user hits save and the macro contiunes like nothing is wrong.
However, the file does not save. The vairable fname, which is the default
file name, is working fine!

FileSaveName = Application.GetSaveAsFilename(fname, filefilter:="Excel Files
(*.xls),*.xls")


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default file won't save!

The GetSaveAsFilename does not save the file, it only allows the user to
provide the name of the file to save. After capturing the name with
GetSaveAsFilename you have to actually save the file with another line of
code. See example below:

Sub SaveMe()

Dim strName As String 'Variable for filename
'Get the file name by displaying the Save As dialog box
strName = Application.GetSaveAsFilename(ActiveWorkbook.Name, _
"Excel Files (*.xls),*.xls")
'Save the file using the name just captured.
ActiveWorkbook.SaveAs Filename:=strName

End Sub

All text prefaced by an apostrophe is a comment...
--
Kevin Backmann


"Mathew" wrote:

Any idea why this line of code won't save the file?? The "Save AS" box comes
up the user hits save and the macro contiunes like nothing is wrong.
However, the file does not save. The vairable fname, which is the default
file name, is working fine!

FileSaveName = Application.GetSaveAsFilename(fname, filefilter:="Excel Files
(*.xls),*.xls")


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 75
Default file won't save!

Kevin: thanks! I thought it would simply save the file.

"Kevin B" wrote:

The GetSaveAsFilename does not save the file, it only allows the user to
provide the name of the file to save. After capturing the name with
GetSaveAsFilename you have to actually save the file with another line of
code. See example below:

Sub SaveMe()

Dim strName As String 'Variable for filename
'Get the file name by displaying the Save As dialog box
strName = Application.GetSaveAsFilename(ActiveWorkbook.Name, _
"Excel Files (*.xls),*.xls")
'Save the file using the name just captured.
ActiveWorkbook.SaveAs Filename:=strName

End Sub

All text prefaced by an apostrophe is a comment...
--
Kevin Backmann


"Mathew" wrote:

Any idea why this line of code won't save the file?? The "Save AS" box comes
up the user hits save and the macro contiunes like nothing is wrong.
However, the file does not save. The vairable fname, which is the default
file name, is working fine!

FileSaveName = Application.GetSaveAsFilename(fname, filefilter:="Excel Files
(*.xls),*.xls")


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
SAVE and SAVE AS options disappeared from the drop down FILE menu [email protected] Excel Discussion (Misc queries) 2 July 12th 07 09:14 AM
when i save xls file, debug script is running and canno't save fil Imtiaz Excel Discussion (Misc queries) 1 July 16th 05 03:47 PM
Excell2003 (SP-1) File > Save and File > Save As.. grayed out Joe Murphy Excel Discussion (Misc queries) 0 March 9th 05 10:00 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM


All times are GMT +1. The time now is 02:51 PM.

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"