Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a excel file from a macro
When using the below code I open a file with a column of dates in a
"d/mm/yyyy" format eg 1/07/2008. When I open the file manually the dates are fine however for some unknown reason when the file opens with the macro dates with a "d" less then 10 are converted to a date and changes the order of the day and month eg 7/01/2008. "d" greater than 9 are not regognised as a date and are shown as a text entry. Does anyone know what is going on?? Workbooks.Open FILENAME:= Range("DEFAULT_FOLDER") & Range ("WORKING_DEFAULT_FILENAME") |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a excel file from a macro
make sure that your computer's date settigns are not American
"Graeme" wrote: When using the below code I open a file with a column of dates in a "d/mm/yyyy" format eg 1/07/2008. When I open the file manually the dates are fine however for some unknown reason when the file opens with the macro dates with a "d" less then 10 are converted to a date and changes the order of the day and month eg 7/01/2008. "d" greater than 9 are not regognised as a date and are shown as a text entry. Does anyone know what is going on?? Workbooks.Open FILENAME:= Range("DEFAULT_FOLDER") & Range ("WORKING_DEFAULT_FILENAME") |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a excel file from a macro
If the file you're opening is a CSV file, then rename the file to .txt.
Then instead of using workbooks.open, you can use Workbooks.OpenText. And that gives you the ability to specify each field (date and the correct order). ps. When some of your data isn't really converted to a real date, that means that much of your data that was converted to dates didn't get converted correctly. Look at what the source data shows and how the data was brought in. It may be a date. But it's not the date you want. Graeme wrote: When using the below code I open a file with a column of dates in a "d/mm/yyyy" format eg 1/07/2008. When I open the file manually the dates are fine however for some unknown reason when the file opens with the macro dates with a "d" less then 10 are converted to a date and changes the order of the day and month eg 7/01/2008. "d" greater than 9 are not regognised as a date and are shown as a text entry. Does anyone know what is going on?? Workbooks.Open FILENAME:= Range("DEFAULT_FOLDER") & Range ("WORKING_DEFAULT_FILENAME") -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro for Opening Reuters, Opening Excel File, Closing Excel File | Excel Programming | |||
Opening an Excel file with macro | Excel Discussion (Misc queries) | |||
Automatically run a macro when opening an Excel file | Excel Programming | |||
Opening text file in Excel through macro | Excel Programming | |||
Opening text file in Excel through macro | Excel Programming |