Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 88
Default Saving as variable file name

I have the following code but it doesn't work as it should, can anyone advise
where I'm going wrong.

Dim Filename
Workbooks.Add
Filename = "Report Week 1.xls"
' Name Workbook
ActiveWorkbook.SaveAs Filename:="D:\Store Returns\Reports\Filename", _
FileFormat:=xlNormal, CreateBackup:=False

Application.DisplayAlerts = False

This will save the file with the name of "Filename" how can I change this
code to reflect the variable name - Filename

Regards

Lee
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Saving as variable file name

strFilename = "Report Week 1"
ActiveWorkbook.SaveAs Filename:="D:\Store Returns\Reports\" & strFilename, _
FileFormat:=xlNormal, CreateBackup:=False

Not tested, but better to avoid using Excel keywords as variable names!

Regards,
Stefi

€˛leerem€¯ ezt Ć*rta:

I have the following code but it doesn't work as it should, can anyone advise
where I'm going wrong.

Dim Filename
Workbooks.Add
Filename = "Report Week 1.xls"
' Name Workbook
ActiveWorkbook.SaveAs Filename:="D:\Store Returns\Reports\Filename", _
FileFormat:=xlNormal, CreateBackup:=False

Application.DisplayAlerts = False

This will save the file with the name of "Filename" how can I change this
code to reflect the variable name - Filename

Regards

Lee

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
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met JMay Excel Discussion (Misc queries) 2 June 17th 07 04:37 PM
Saving worksheet in new file with date AND cell value as file name michaelberrier Excel Discussion (Misc queries) 4 May 26th 06 08:05 PM
Text file saving, setting file origin mauddib Excel Discussion (Misc queries) 0 May 25th 06 02:50 PM
Excel should let me sort the file directory when saving a file Beanee70 Excel Discussion (Misc queries) 0 March 14th 06 07:03 AM
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM


All times are GMT +1. The time now is 01:13 PM.

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

About Us

"It's about Microsoft Excel"