Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default Saving a Workbook using info from a Cell???

I have searched this site and found some items that relate to my issue but
everything I have tried does not seem to work.



I am using code to open a new workbook where certain parts of the original
information are copied to. I am then trying to save this new Workbook under
the date that occurs in Range("E2") on a worksheet named Data Entries of the
original workbook entitled Data.xls to a certain file location. The code I
have so far is:



Code:
    Workbooks.Add

    ActiveWorkbook.SaveAs Filename:= _

        "C:\Documents and Settings\schoes14\Desktop\Min Out Reports\Min Out 
Report.xls", FileFormat:= _

        xlNormal, Password:="", WriteResPassword:="", 
ReadOnlyRecommended:=False _

        , CreateBackup:=False


I would like the date to appear right before " Min Out Report.xls"



Any help would be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Saving a Workbook using info from a Cell???

Hi Scott,

Firstly you need to assin the value of cell E2 to a variable, say
qdate

qdate = Range("E2").Value

Then construct the string by which you want to save the file as
follows into variable qfile:-

qfile = "C:\Documents and Settings\schoes14\Desktop\Min Out Reports\"
& qdate & " Min Out Report.xls"

Then save file as qfile.

Workbooks.Add
ActiveWorkbook.SaveAs Filename:=qfile _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

Hope this helps, Any problems get in touch.

Ant
http://www.excel-ant.co.uk

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default Saving a Workbook using info from a Cell???

I had searched the site before posting this but I must not have had the
correct words in the search. When I search for my post using part of my
Subject line I actually found the answer to this question.

Thanks.

"Scott" wrote:

I have searched this site and found some items that relate to my issue but
everything I have tried does not seem to work.



I am using code to open a new workbook where certain parts of the original
information are copied to. I am then trying to save this new Workbook under
the date that occurs in Range("E2") on a worksheet named Data Entries of the
original workbook entitled Data.xls to a certain file location. The code I
have so far is:



Code:
 
     Workbooks.Add
 
     ActiveWorkbook.SaveAs Filename:= _
 
         "C:\Documents and Settings\schoes14\Desktop\Min Out Reports\Min Out 
 Report.xls", FileFormat:= _
 
         xlNormal, Password:="", WriteResPassword:="", 
 ReadOnlyRecommended:=False _
 
         , CreateBackup:=False
 



I would like the date to appear right before " Min Out Report.xls"



Any help would be greatly appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Saving a Workbook using info from a Cell???

Let's get the cell value and then add the new workbook:

Sub Macro1()
namevalue = Workbooks("Data.xls").Sheets("Data Entries").Range("E2").Text
MsgBox (namevalue)
Workbooks.Add
ActiveWorkbook.SaveAs Filename:="C:\test\Book" & namevalue & ".xls"
End Sub

NOTE the date in the cell was 4 December 2008
I used the Text property to get the date without slashes.
--
Gary''s Student - gsnu200817


"Scott" wrote:

I have searched this site and found some items that relate to my issue but
everything I have tried does not seem to work.



I am using code to open a new workbook where certain parts of the original
information are copied to. I am then trying to save this new Workbook under
the date that occurs in Range("E2") on a worksheet named Data Entries of the
original workbook entitled Data.xls to a certain file location. The code I
have so far is:



Code:
 
     Workbooks.Add
 
     ActiveWorkbook.SaveAs Filename:= _
 
         "C:\Documents and Settings\schoes14\Desktop\Min Out Reports\Min Out 
 Report.xls", FileFormat:= _
 
         xlNormal, Password:="", WriteResPassword:="", 
 ReadOnlyRecommended:=False _
 
         , CreateBackup:=False
 



I would like the date to appear right before " Min Out Report.xls"



Any help would be greatly appreciated.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default Saving a Workbook using info from a Cell???

Thanks alot. Your response actually helped to shorten everything I was using
each time I wanted to save. The shorter the code the better I say.

"excel-ant" wrote:

Hi Scott,

Firstly you need to assin the value of cell E2 to a variable, say
qdate

qdate = Range("E2").Value

Then construct the string by which you want to save the file as
follows into variable qfile:-

qfile = "C:\Documents and Settings\schoes14\Desktop\Min Out Reports\"
& qdate & " Min Out Report.xls"

Then save file as qfile.

Workbooks.Add
ActiveWorkbook.SaveAs Filename:=qfile _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

Hope this helps, Any problems get in touch.

Ant
http://www.excel-ant.co.uk




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving a Workbook using info from a Cell???

dim sFileNameDate as string

sFileNameDate = Workbooks("data.xls").Sheets("Data Entries").Range("E2").value

ActiveWorkbook.SaveAs Filename:= "C:\Documents and
Settings\schoes14\Desktop\Min Out Reports\" & sFileNameDate & "Min Out
Report.xls"



Something like that anyway...

"Scott" wrote:

I have searched this site and found some items that relate to my issue but
everything I have tried does not seem to work.



I am using code to open a new workbook where certain parts of the original
information are copied to. I am then trying to save this new Workbook under
the date that occurs in Range("E2") on a worksheet named Data Entries of the
original workbook entitled Data.xls to a certain file location. The code I
have so far is:



Code:
 
     Workbooks.Add
 
     ActiveWorkbook.SaveAs Filename:= _
 
         "C:\Documents and Settings\schoes14\Desktop\Min Out Reports\Min Out 
 Report.xls", FileFormat:= _
 
         xlNormal, Password:="", WriteResPassword:="", 
 ReadOnlyRecommended:=False _
 
         , CreateBackup:=False
 



I would like the date to appear right before " Min Out Report.xls"



Any help would be greatly appreciated.

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
Losing Cell Protection When Saving Workbook Chaplain Doug Excel Discussion (Misc queries) 5 August 23rd 06 12:28 AM
Losing Cell Protection When Saving Workbook Chaplain Doug Excel Programming 2 August 22nd 06 06:20 PM
Saving Worksheet from Workbook with Names from Cell Values Marc Baumann Excel Programming 0 January 17th 06 12:45 PM
How can I link one cell to a list of info in another workbook? PaulGrowns1 Excel Discussion (Misc queries) 3 November 24th 05 09:02 PM
How do I create a workbook that links info in cell to a calendar? JH Excel Worksheet Functions 2 March 30th 05 09:45 PM


All times are GMT +1. The time now is 03:37 AM.

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"