I have used this code to create a macro that inserts a DatePicker in a Word document on my Mac:
Sub AddDatePickerCC_GermanExt()
Dim oCC As ContentControl
Set oCC = ActiveDocument.ContentControls.Add(wdContentControlDate, Selection.Range)
With oCC
.DateCalendarType = wdCalendarWestern
.DateDisplayFormat = "d. MMMM yyyy"
.DateDisplayLocale = wdGerman
End With
Set oCC = Nothing
End Sub
Adapted from this guide: Content Controls for macOS
While this works when I have set my Word to German, it fails when the language of Word is changed to English (region is left to Germany).
The error says:
This calendar type is not available for the current date languange.
The debugger points to .DateCalendarType = wdCalendarWestern but changing this makes no sense, since the Mac's calendar is set to Gregorian.
The field is inserted, but in the format 01/01/2024 and not as specified.
Any advice? Thank you already!
I actually managed now. If anybody has the same problem, it is the order under
With oCCThe correct code would be:
It works correctly then.