View Single Post
 
Old 03-16-2015, 08:32 AM
dkohnken dkohnken is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Mar 2015
Posts: 3
dkohnken is on a distinguished road
Default Help with a Command Button

I have built a Word 2013 form which contains Legacy Controls, ActiveX Controls and the Date Picker from the default controls in the Developer tab.
I am relatively new building forms in Word. I hope this is not too wordy, but I am not sure how to explain it.

This form is for Supervisors and managers to enter information about new Employees. Some of the information, Name, Supervisor name, start date, approving department head and email for department head.

I have added several VBA Macros, one to read the name of the Department Head and get their email from Active Directory. This all works good, even when I open a new document from the template.

I added a button at the bottom of the form to validate all required information, which as a dotm works great. But after saving the dotm file, and open the dotm as a new document the code that I entered in the button's click event is not there. It seems that the code is not being written to the Click event of the new form. If I unprotect the new document and click on the Developer Tab and view the code, All I have is Private Sub Submit_Click() and no code. Listed underneath the new Document in the VBA editor is the original template. Clicking on ThisDocument and viewing the code, I see my Private Sub Submit_Click() with all the code I wrote.

I have gone into the Trust Center and enabled Macros and ActiveX.
I have searched for answers, but found none that work. Am I doing something wrong? Any help would be appreciated. Thank you in advance for all your help.
Reply With Quote