Hi!
I am learning VBA and have a Q for the forum. When using this code
Sub SaveFileAs()
Dim stFpath As String
Dim stFname As String
'Folder to store file
stFpath = "C:\JBStat\"
'Name of workbook
stFname = Range("B1").Value & ".txt"
ActiveWorkbook.SaveAs stFpath & stFname, FileFormat:=xlText, CreateBackup:=False
End Sub
Really simple as you can see...I get a different formating inside the file (the dates in column two gets 5/14/2004 instead of (the way I want) 2004-05-14 as I get when I use the macro recorder and get this code.
Sub Makro2()
ActiveWorkbook.SaveAs Filename:="C:\JBStat\20040514.txt", FileFormat:= _
xlText, CreateBackup:=False
End Sub
Examples of the outcome of the different macros.
Sub SaveFileAs() 1 5/14/2004 10:26 1 91-0010309-8
Sub Makro2()1 2004-05-14 10:26 1 91-0010309-8
BTW I use XP and Swedish version of XL 2003.
Any formatting experts out there? TIA :yes:
Have a great weekend all! /Mats
:cool: