Link to home
Start Free TrialLog in
Avatar of Annmv888
Annmv888

asked on

Word if statement for the calendar activex on a docm word 2010 document

I was given (I did not create it) a .docm document with a calendar activex control for Word 2010 so you can click the dropdown and pick a date.  On a command button I need to write an if statement so if there isn't a date they get a message stating this is mandatory and they are taken back to the date so they can enter it again...but if there is a date then another form should open.

When I look at the properties of the calendar control the content control properties window opens and there is a Title and Tag both named InvDate.  There is also a bookmark with the same InvDate for this date.

I'm at a loss how to do this in Word.  I only know a little VBA for Access.

Thanks in advance for any help you can give me.
Avatar of Rgonzo1971
Rgonzo1971

Hi,

Could you send a dummy?

Regards
Hi,

pls try
Sub macro()
Set cc = ActiveDocument.SelectContentControlsByTitle("invDate").Item(1)
If cc.Range.Text = "Click here to enter a date." Then ' no date
    MsgBox "No date"
Else

End If
End Sub

Open in new window

Regards
Avatar of Annmv888

ASKER

Hi,  I couldn't upload the file.  I received the following:   "The extension of the uploaded file is not in the list of accepted extensions."

I had to send an email to get it added to the file extension list and will be notified once they have added it.  Then I will be able to upload the file.
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This worked great!  Thank you for the help.