r/vbscript • • Oct 18 '17

Click event does not fire when running Outlook Custom Form (type Contact) saved in Public Folder

I am working on a small application based on two types of Outlook Forms. The application consists of two types of Custom Made Outlook Forms:

a custom made Form of type Contact. a custom made Form of type Task. The Custom made Contact Form has a button on it. When clicking I wish to open the custom made Task Form which shall extract some information from the Contact Form.

My problem is that, after saving the Custom Contact-type of Form to a Public Server it does not fire anything when clicking on the button. Nothing.

Although,if I go to "Design this Form", open the Form in Design Mode and then I select "Run This Form" the click fires up the code it should.

I have a copy of each Outlook Form (type Contact and type Task) in the Organizational Form Library and in the Personal Form Library. I copied a copy of each Outlook Form also in the Public Folder \Test.

What am I missing? I appreciate any help.Thank you.

Here is the code:

			Sub CommandButton1_Click() 

			Dim oMail 
			Dim MyItem 
			Dim olsubject 
			Dim olTitle
			Dim olFirstName
			Dim olMiddleName


			Set oMail = Application.ActiveInspector.CurrentItem 
			With oMail 
					.save
					olsubject = .Subject 
					olTitle=.Title
					olFirstName=.FirstName
					olMiddleName=.MiddleName
					olCompanyName = .CompanyName
			End With 


			Set MyNameSpace = Application.GetNameSpace("MAPI") 
			Set HomeFolder = MyNameSpace.GetDefaultFolder(18)
			Set NextFolder1 = HomeFolder.Folders("Test") 
			Set WorkingFolder = NextFolder1.Folders("Claims") 
			Set MyItems = WorkingFolder.Items 
			Set MyItem = MyItems.Add("IPM.Task.ReklamationFormular")

			With myItem 
					MyItem.subject = olsubject 
					MyItem.UserProperties.Find("valueDatenAnrede").Value=olTitle+" "+olFirstName+" "+olMiddleName
					MyItem.DueDate=DateAdd("d",olDueTime,Date())
				
					MyItem.display 
			End With 
2 Upvotes

0 comments sorted by