So it's my turn to feel sorry for taking it for given that my post could suffice. I will be more precise.
I need to explain why I consider it more expensive to control the code by the product name than by an error handler. The format change of the date *and time* controls started with LO 4.1 as far as I know. Maybe you can rely on this. But who knows at which point of time the AOO developers will decide to follow their colleagues and likewise change their API? And what about some other OpenOffices? (I don't know anything about them.)
This is the listing in question with the comments in English:Listing 534. Initialize a date control to today’s date (works with all versions of AOO and LO).
REM Initialize the date control. REM Set the initial date to TODAY. Dim tToday As Date tToday = Date() On Error Goto LO REM Try to initialize the control with a Long Integer. REM This is the correct format for AOO and for older versions of LO. oOOMEDlg.getModel().getByName("MyDateField").Date = CdateToIso(tToday) On Error Goto 0 'Clear the error handler. Goto GoOn LO: REM On Error the control is initialized using a structure. REM This is the correct format for newer versions of LO. On Error Goto 0 'Clear the error handler to prevent an infinite loop, 'in case the macro runs into some other runtime error. Dim oToday As New com.sun.star.util.Date oToday.Year = Year(tToday) oToday.Month = Month(tToday) oToday.Day = Day(tToday) oOOMEDlg.getModel().getByName("MyDateField").Date = oToday GoOn: Greetings Volker -- To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted