![]() |
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/ |
Macro drops date formatting to csv file
I have researched this everywhere and I can't find any information.
Any help would be greatly appreciated! ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 12:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com