Saving as a Template means code doesn't work

M

Michael Anderson

I have customised an Outlook Contacts Form with the code...

Sub Item_CustomPropertyChange(ByVal Name)

If Name = "mxzMembershipStartDate" Then
dteDate = Item.UserProperties("mxzMembershipStartDate").Value
dteNextDate = DateAdd("m", 12, dteDate)
Item.UserProperties("mxzMembershipRenewalMonth").Value = dteNextDate

If Item.UserProperties("mxzMembershipStartDate").Value = "" Then
dteNextDate = 12/12/2000
Item.UserProperties("mxzMembershipRenewalMonth").Value = dteNextDate
End If
End If


End Sub

Sub mxzAddressButton_Click()

If Item.UserProperties("Other Address Street").Value = "" Then
Item.UserProperties("Other Address Street").Value =
Item.UserProperties("Business Address Street").Value
End If
If Item.UserProperties("mxzOtherSuburb").Value = "" Then
Item.UserProperties("mxzOtherSuburb").Value =
Item.UserProperties("mxzBusinessSuburb").Value
End If
If Item.UserProperties("Other Address City").Value = "" Then
Item.UserProperties("Other Address City").Value =
Item.UserProperties("Business Address City").Value
End If
If Item.UserProperties("Other Address Postal Code").Value = "" Then
Item.UserProperties("Other Address Postal Code").Value =
Item.UserProperties("Business Address Postal Code").Value
End If
End Sub

I want to give this to someone else. I saved this as a template. When I load
the Template my code does nothing. I guess copying the contents of the form
code to a text file and pasting it on an existing Contact form is one
alternative. I thought templates were better than that!
 
S

Sue Mosher [MVP-Outlook]

Code hasn't run on template file forms for more than five years. They're not considered secure. If you want form code to run, give the .oft file to the other person and explain how they must publish the form.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top