Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use macro to save file w/today's date 2

Status
Not open for further replies.

gshadz37

Technical User
Mar 21, 2005
102
US
I've created the macro below to convert & save a text file to excel, but am not sure how to add today's date to the saved file name, here's what I have so far:

Sub TEST_IMPORT()
'
' TEST_IMPORT Macro

'
ChDir "S:\Repair Operations Center\T1ger Team MTTR Reporting"
Workbooks.OpenText Filename:= _
"S:\Repair Operations Center\T1ger Team MTTR Reporting\DS0 IMP.txt", Origin:= _
437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), Array(9, 1), _
Array(10, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array( _
16, 1), Array(17, 1)), TrailingMinusNumbers:=True
ChDir "S:\Repair Operations Center\T1ger Team MTTR Reporting\converted\DS0 IMP"
ActiveWorkbook.SaveAs Filename:= _
"S:\Repair Operations Center\T1ger Team MTTR Reporting\converted\DS0 IMP\DS0 IMP NOW().xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Any suggestions would be greatly appreciated.
 
Perhaps something like this ?
ActiveWorkbook.SaveAs Filename:= _
"S:\Repair Operations Center\T1ger Team MTTR Reporting\converted\DS0 IMP\DS0 IMP " _
& Format(Date, "yyyy-mm-dd") & ".xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="" _
, ReadOnlyRecommended:=False, CreateBackup:=False

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top