ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ShowDataForm Date format wrong (https://www.excelbanter.com/excel-programming/298783-showdataform-date-format-wrong.html)

RichardS

ShowDataForm Date format wrong
 
I have an Excel database with dates in the format
dd/mm/yyyy. If I select the Data | Form option from the
standard menu bar, the dates look fine. If I activate the
DataForm through VBA with the above command, the dates
display as mm/dd/yyyy. I can overwrite the date using the
Data Form in the correct format, then scroll back to that
record and it still displays as mm/dd/yyyy. Underlying
data is fine, just the display on the Data Form when
called using VBA is incorrect.

yogendra joshi

ShowDataForm Date format wrong
 
Yes Indeed interesting :(....

Will try to dig out a bit... but looks like some setup issue



RichardS wrote:

I have an Excel database with dates in the format
dd/mm/yyyy. If I select the Data | Form option from the
standard menu bar, the dates look fine. If I activate the
DataForm through VBA with the above command, the dates
display as mm/dd/yyyy. I can overwrite the date using the
Data Form in the correct format, then scroll back to that
record and it still displays as mm/dd/yyyy. Underlying
data is fine, just the display on the Data Form when
called using VBA is incorrect.



Thomas Ramel

ShowDataForm Date format wrong
 
Grüezi Richard

RichardS schrieb am 19.05.2004

I have an Excel database with dates in the format
dd/mm/yyyy. If I select the Data | Form option from the
standard menu bar, the dates look fine. If I activate the
DataForm through VBA with the above command, the dates
display as mm/dd/yyyy. I can overwrite the date using the
Data Form in the correct format, then scroll back to that
record and it still displays as mm/dd/yyyy. Underlying
data is fine, just the display on the Data Form when
called using VBA is incorrect.


When you activate the DataForm by VBA Excel will use the US-Format to
display dates - aour issue is a typical regional-settings problem. I think
you don't have US-regional-settings?

Instead of something like this

ActiveSheet.ShowDataForm

try the following:

ActiveSheet.UsedRange.Cells(1, 1).Activate
Application.CommandBars.FindControl(ID:=860).Execu te

You have to select first *1* cell within the datarange of your worksheet.
Thats what the first line is for. If you already know cour range you can
activate a cell directly by its address.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]

RichardS

ShowDataForm Date format wrong
 

-----Original Message-----
Grüezi Richard

RichardS schrieb am 19.05.2004

I have an Excel database with dates in the format
dd/mm/yyyy. If I select the Data | Form option from the
standard menu bar, the dates look fine. If I activate

the
DataForm through VBA with the above command, the dates
display as mm/dd/yyyy. I can overwrite the date using

the
Data Form in the correct format, then scroll back to

that
record and it still displays as mm/dd/yyyy. Underlying
data is fine, just the display on the Data Form when
called using VBA is incorrect.


When you activate the DataForm by VBA Excel will use the

US-Format to
display dates - aour issue is a typical regional-settings

problem. I think
you don't have US-regional-settings?

Instead of something like this

ActiveSheet.ShowDataForm

try the following:

ActiveSheet.UsedRange.Cells(1, 1).Activate
Application.CommandBars.FindControl(ID:=860).Exec ute

You have to select first *1* cell within the datarange of

your worksheet.
Thats what the first line is for. If you already know

cour range you can
activate a cell directly by its address.

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]
.

Thomas,

Thank-you very much. Works like a charm

Regards

Richard

Thomas Ramel

ShowDataForm Date format wrong
 
Grüezi Richard

RichardS schrieb am 20.05.2004

Thank-you very much. Works like a charm


I'm glad aou like it :-)

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]


All times are GMT +1. The time now is 08:04 PM.

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