|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I use Excel automation from VB to open a Worksheet and save it as text, the save method writes date with a strange behavior.
If my PC regional settings are dd/mm/yyyy and the excel cell format is dd/mm/yyyy, the resulting field goes mm/dd/yyyy. All the other 3 combinations (PC dd/mm and cell dd/mm; PC mm/dd and cell mm/dd; PC mm/dd and cell dd/mm) goes ok. I need to run the code against all 4 combinations. Is there any way to force a right formatting? The code is: Set objExcApp = GetObject("", "Excel.Application") Set objExcWb = objExcApp.Workbooks.Open("mydata.xls") Set objExcWs = objExcWb.Worksheets("sheet1") objExcWs.SaveAs FileName:="mydata.txt", FileFormat:=xlText, CreateBackup:=False |
|
#2
|
|||
|
|||
|
u try the NumberFormat proper:
Worksheets("Sheet1").Range("A17").NumberFormat = "General" Worksheets("Sheet1").Rows(1).NumberFormat = "hh:mm:ss" Worksheets("Sheet1").Columns("C"). _ NumberFormat = "$#,##0.00_);[Red]($#,##0.00)" |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Date formats when saving an excel from VB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|