Forum Discussion

JulesAnth's avatar
JulesAnth
Copper Contributor
Mar 05, 2023

How to create and implement date picker macro in word for Mac

I'm hoping someone can help me asap.

I'm trying to add a date picker macro in MS 365 Word V16.70 for Mac.

 

I got in touch with the chat people and they were able to give me the following formula to add to Visual Basic Editor:

In the Visual Basic Editor, on the Insert menu choose Insert > Module. A blank white area will display.

In the blank area, type or paste the following:

 

Sub AddDatePicker()

 

Dim objCC As ContentControl

Dim objDate As Date

Set objCC = ActiveDocument.ContentControls _ .Add(wdContentControlDate) objDate = Date objCC.Range.Text = objDate

End Sub

 

Make sure the blinking cursor is somewhere in your code.

On the Run menu choose Run Sub/UserForm

On the Word menu choose Close and Return to Microsoft Word.

You will see your date picker.

 

Unfortunately I get the following message:

Compile Error: Syntax Error

The following information replaced the original VBE instruction:

Set objCC = ActiveDocument.ContentControls _ .Add(wdContentControlDate) objDate = Date objCC.Range.Text = objDate

 

I had no idea that there was this much difference between the Word for Mac and Word for PC 🤦🏼‍:female_sign: This is sooooooo frustrating.

 

If anyone could assist I would sincerely appreciate it.

 

Resources