josh.clare
Board Regular
- Joined
- Feb 25, 2010
- Messages
- 144
Hello everyone,
i have a macro that deletes the top two lines of an excel and saves it as a csv. however its changing the date format from dd/mm/yyyy to mm/dd/yyyy. i would like to keep the date format as dd/mm/yyyy.
Can someone please help, i have attatched the code below,
thanks,
josh
i have a macro that deletes the top two lines of an excel and saves it as a csv. however its changing the date format from dd/mm/yyyy to mm/dd/yyyy. i would like to keep the date format as dd/mm/yyyy.
Can someone please help, i have attatched the code below,
Code:
[COLOR=#0000ff]Public[/COLOR] [COLOR=blue]Sub[/COLOR] LoopFiles()
[COLOR=blue]Dim[/COLOR] strPath [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR], strFileName [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR]
strPath = "C:\" [COLOR=green]'change path here[/COLOR]
strFileName = [COLOR=blue]Dir[/COLOR](strPath & "*.xl*")
[COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] [COLOR=blue]Len[/COLOR](strFileName) > 0
[COLOR=blue]With[/COLOR] Workbooks.Open(strPath & strFileName)
.Sheets(1).Rows("1:2").Delete
.SaveAs Filename:=.Path & .Name & ".csv", FileFormat:=xlCSV
.Close [COLOR=blue]False[/COLOR]
[COLOR=blue]End[/COLOR] [COLOR=blue]With[/COLOR]
strFileName = [COLOR=blue]Dir[/COLOR]
[COLOR=blue]Loop[/COLOR]
[COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR]
thanks,
josh