View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
bslater bslater is offline
external usenet poster
 
Posts: 1
Default Macro drops date formatting to csv file

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!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/