I am learning VBA and have a Q for the forum. When using this code
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
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.
ActiveWorkbook.SaveAs Filename:="C:\JBStat\20040514.txt", FileFormat:= _
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