Macro drops date formatting to csv file

B

bslater

Hi,
I have a macro that pulls data from a database and formats it prior
to saving it into a csv file. This macro has worked perfectly for 6-7
months but recently it has started to fail. The date formatting does
not save into the csv file. Below is the coding...

ActiveSheet.Rows(1).Delete
Columns("A:A").EntireColumn.AutoFit
wk.Sheets("sheet1").Range("B:C,H:H").Select
wk.Sheets("sheet1").Range("H1").Activate
Selection.NumberFormat = "m/d/yy h:mm"
wk.Sheets("sheet1").Columns("E:F").Select
Selection.NumberFormat = "0.000000"
wk.Sheets("sheet1").Range("B1").Select
Selection.Sort Key1:=wk.Sheets("sheet1").Range("B1"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

PivotName = "aep_tx_forecast_cc_short_" & Format(GetValTime,
"yyyymmdd")
wk.SaveAs "Y:\ALLEGRO-UPLOAD\LSHAPES\PROD\TEXAS\" & PivotName,
xlCSV
'wk.Close (False)

As you can see i have recently commented out the close command. If I
don't close the file and manually resave, the file saves the formatting
correctly. So basically, only manually saving the file will give me
the date formatting I need. Any thoughts?

I am running Excel2000 9.0.4402 SR-1

Thanks!
 
B

bslater

I have researched this everywhere and I can't find any information.
Any help would be greatly appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top