Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Naming and saving a workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin Porter - 21 Feb 2007 21:23 GMT
I want to be able to open a new workbook (which I can do) then save it as
workbook name + (value in B1 on open workbook, which will be a date).xls

How do I do this.  I can open the workbook and name it and save it, but I
want to be able to add the date in B1 to the name.

Thanks.
Jim Thomlinson - 21 Feb 2007 21:45 GMT
Post the code that you have so far...
Signature

HTH...

Jim Thomlinson

> I want to be able to open a new workbook (which I can do) then save it as
> workbook name + (value in B1 on open workbook, which will be a date).xls
[quoted text clipped - 3 lines]
>
> Thanks.
Kevin Porter - 21 Feb 2007 21:55 GMT
Sub CreateDetailWB()
'
' CreateDetailWB Macro
' Macro recorded 2/20/2007 by Kevin Porter
'

'
   Dim WBDate As String
   
   WBDate = Workbooks("SRA Payroll Details.xlt").Sheets("List").Cells(A2)
   Workbooks.Add
   Sheets("Sheet3").Select
   ActiveWindow.SelectedSheets.Delete
   Sheets("Sheet2").Select
   ActiveWindow.SelectedSheets.Delete
   ChDir "\\dc\SRAO\Intuit\Payroll 2007"
   ActiveWorkbook.SaveAs Filename:= _
       "\\dc\SRAO\Intuit\Payroll 2007\SRA Detailed Payroll - " & WBDate &
".xls", FileFormat:= _
       xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
       , CreateBackup:=False
       
End Sub

> Post the code that you have so far...
>
[quoted text clipped - 5 lines]
> >
> > Thanks.
Vergel Adriano - 21 Feb 2007 23:05 GMT
Do you mean cell A2 in SRA Payroll Details contains the date you want to add
to the filename?  If so, then:

WBDate = Format(Workbooks("SRA Payroll
Details.xlt").Sheets("List").Cells(A2), "yyyymmdd")

> Sub CreateDetailWB()
> '
[quoted text clipped - 33 lines]
>> >
>> > Thanks.
Vergel Adriano - 21 Feb 2007 23:09 GMT
correction:

WBDate = Format(Workbooks("SRA Payroll
Details.xlt").Sheets("List").Range("A2").text, "yyyymmdd")

> Do you mean cell A2 in SRA Payroll Details contains the date you want to
> add to the filename?  If so, then:
[quoted text clipped - 46 lines]
> ----= East and West-Coast Server Farms - Total Privacy via Encryption
> =----
Tom Ogilvy - 22 Feb 2007 16:18 GMT
Seems to me, using the Text property to pass a date string to format would
increase the possibility of  misinterpretation which would be avoided by
using Value

WBDate = Format(Workbooks("SRA Payroll
Details.xlt").Sheets("List").Range("A2").Value, "yyyymmdd")

Signature

Regards,
Tom Ogilvy

> correction:
>
[quoted text clipped - 55 lines]
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Kevin Porter - 22 Feb 2007 16:42 GMT
Thank you.  Worked like a dream.

> correction:
>
[quoted text clipped - 55 lines]
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.