Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using Date$ function in file name


I am trying to get code built into a worksheet that will allow me t
toggle between two sheets that I have open. The problem is that one o
the files will have one name when a portion of the code is run, an
will be saved as a new name before the rest of the code runs (e.g.
Wells_ACH.xls will be saved as Wells_ACH-11-02-05.xls). The new fil
will have the same name with the current date added for audit purposes
I have attempted to use the following to call the procedure, but I a
having trouble. Any help or suggestions would be appreciated.

In the worksheet with the button:

Private Sub CommandButton2_Click()

Current = Date$
Application.Run "Wells_ACH-&CurrentDate&.xls!Export_Data"

End Sub

In the module with the macro:
Sub Export_Data()

Application.ScreenUpdating = False
CurrentDate = Date$

'Export and Format Data from Column A
Windows("Wells_ACH-&CurrentDate&.xls").Activate
Sheets("ACH_Calculation").Select
Range("A:A").Select
Selection.Copy
Windows("ach import.csv").Activate
Range("A1").Select
ActiveSheet.Paste


'Export Data from Column B
Windows("Wells_ACH-&MyDate&.xls").Activate
Sheets("Previous_ACH").Select
Range("C:C").Select
Selection.Copy
Windows("ach import.csv").Activate
Range("B1").Select
ActiveSheet.Paste
Range("A1").Select


'Format Columns for Bank Upload
Windows("ach import.csv").Activate
Range("A:A").Select
Selection.NumberFormat = "0000"
Range("A1").Select


'Save and Close File
ActiveWorkbook.SaveAs Filename:= _
"J:\Treasury\Cash Forecasting\ach_module\ach calculation
spreadsheets\Wells Fargo\ach import.csv" _
, FileFormat:=xlCSV, CreateBackup:=False
ActiveWindow.Close

Windows("Wells_ACH.xls").Activate
Sheets("ACH_Calculation").Select
Range("A1").Select

End Su

--
tobrian
-----------------------------------------------------------------------
tobriant's Profile: http://www.excelforum.com/member.php...fo&userid=2515
View this thread: http://www.excelforum.com/showthread.php?threadid=48100

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
Recovering File Info Specifically Save Date or Print Date Gadgetgw Excel Discussion (Misc queries) 4 October 6th 08 08:43 PM
todays's function, if I open file date changes MaT Excel Discussion (Misc queries) 1 November 22nd 07 07:45 PM
Excel should have a function for last date and time file was saved fwbuckley Excel Worksheet Functions 11 August 15th 07 11:04 PM
Syntax for Info or Cell function for xl. file creation date driller Excel Worksheet Functions 5 January 29th 07 07:51 PM
Using Date$ function in file name tobriant[_4_] Excel Programming 0 November 2nd 05 04:49 PM


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