ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with writing CString Date to cell (https://www.excelbanter.com/excel-programming/313475-problem-writing-cstring-date-cell.html)

Macca

Problem with writing CString Date to cell
 
I am using automation to write data from Visual C++ 6 to an excel
spreadsheet.

I am having problem writing the string "12/10/2004" to a cell as it swaps
the 10 and 12 around!!!. I assume this has something to do with american
dates.

I use the code below to write the string to the cell i want :-

m_objRange = m_objSheet2.GetRange(COleVariant("A3"),COleVariant ("A3"));
m_objRange.SetValue2(COleVariant("12/10/2004"));


It write the string to the correct cell but the day and month have been
swapped. Can anyone tell me how i can stop this happening?

Thanks In Advance
Macca



Frank Kabel

Problem with writing CString Date to cell
 
Hi
why not format the cell to a different date format?

--
Regards
Frank Kabel
Frankfurt, Germany


Macca wrote:
I am using automation to write data from Visual C++ 6 to an excel
spreadsheet.

I am having problem writing the string "12/10/2004" to a cell as it
swaps the 10 and 12 around!!!. I assume this has something to do with
american dates.

I use the code below to write the string to the cell i want :-

m_objRange =
m_objSheet2.GetRange(COleVariant("A3"),COleVariant ("A3"));
m_objRange.SetValue2(COleVariant("12/10/2004"));


It write the string to the correct cell but the day and month have
been swapped. Can anyone tell me how i can stop this happening?

Thanks In Advance
Macca



macca

Problem with writing CString Date to cell
 
Thanks for the tip Frank. How do I do this through Automation?

Thanks,
Macca

"Frank Kabel" wrote:

Hi
why not format the cell to a different date format?

--
Regards
Frank Kabel
Frankfurt, Germany


Macca wrote:
I am using automation to write data from Visual C++ 6 to an excel
spreadsheet.

I am having problem writing the string "12/10/2004" to a cell as it
swaps the 10 and 12 around!!!. I assume this has something to do with
american dates.

I use the code below to write the string to the cell i want :-

m_objRange =
m_objSheet2.GetRange(COleVariant("A3"),COleVariant ("A3"));
m_objRange.SetValue2(COleVariant("12/10/2004"));


It write the string to the correct cell but the day and month have
been swapped. Can anyone tell me how i can stop this happening?

Thanks In Advance
Macca





All times are GMT +1. The time now is 11:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com