Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default saving a worksheet as a .txt file with filename of specified cell

I am trying to save one worksheet in my workbook as a .txt file. I
want the name of the file to equal
Worksheets("Weekly").Range("A1"). (which will change montly, that's
why it cannot be a static defined name)
My Macro runs, but the problem is that it always equals the name of my
variable, which is "ThisFile". I need to save it in a specific
location U:\myfolder\ThisFile
Please review code below and provide assistance if you can.
Thanks!


Sub createplan()

ThisFile = Worksheets("Weekly").Range("A1")
ActiveWorkbook.SaveAs Filename:= _
"U:\myfolder\ThisFile", FileFormat:=xlText _
, CreateBackup:=False

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default saving a worksheet as a .txt file with filename of specified cell

On Mar 3, 1:10 pm, wrote:
I am trying to save one worksheet in my workbook as a .txt file. I
want the name of the file to equal
Worksheets("Weekly").Range("A1"). (which will change montly, that's
why it cannot be a static defined name)
My Macro runs, but the problem is that it always equals the name of my
variable, which is "ThisFile". I need to save it in a specific
location U:\myfolder\ThisFile
Please review code below and provide assistance if you can.
Thanks!

Sub createplan()

ThisFile = Worksheets("Weekly").Range("A1")
ActiveWorkbook.SaveAs Filename:= _
"U:\myfolder\ThisFile", FileFormat:=xlText _
, CreateBackup:=False

End Sub


Use the & sign to concatenate strings:

Sub createplan()

ThisFile = Worksheets("Weekly").Range("A1")
ActiveWorkbook.SaveAs Filename:= _
"U:\myfolder\" & ThisFile, FileFormat:=xlText _
, CreateBackup:=False

End Sub

Cheers!
Nate
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
Saving file using value in cell as the filename BCassedy Excel Worksheet Functions 3 July 7th 07 12:43 AM
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
Saving a file to have the filename of the dated it was created Dave[_65_] Excel Programming 1 May 17th 06 10:42 AM
Filename has Url in file-save dialog when saving exported Excel do GJones Excel Programming 0 September 1st 04 08:17 PM
Saving Cell value as filename Kathy B Excel Programming 1 July 24th 03 10:59 PM


All times are GMT +1. The time now is 02:54 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"