VB script in outlook form doesn't work anymore

Status
Not open for further replies.
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I used the following script for years in a customized outlook form to populate a combo box with outlook contacts. This worked fine until a couple of months ago. Now it doesn't work anymore.

Sub Item_Open()

Dim FullArray()

' Sets the name of page on the form (Termindetails)
Set FormPage = Item.GetInspector.ModifiedFormPages("Termindetails")

' Sets Control to a list box called ComboBox1.
Set Control = FormPage.Controls("ComboBox1")

' Get the default Contacts folder
Set ConFolder = Application.Session.GetDefaultFolder(10)

' Get the items in the folder
Set ConItems = ConFolder.Items

' Create a restrict filter
strFilter = "[Journal] = 1 "

' Just get those contacts with a Journal entry
set colResItems = ConItems.Restrict(strFilter)

' Sort the contacts based on LastName
colResItems.Sort "[LastName]"

' Get the number of total items in the Contacts folder
NumItems = colResItems.Count

' Sort the contacts based on LastName
' ConItems.Sort "[LastName]"

' Resize array to handle total number of item in the folder
ReDim FullArray(NumItems-1,4)

' Loop through all of the items in the Contacts folder,
' filling the array with sample data and keeping track
' of the number of contacts found.
NumContacts = 0
For I = 1 to NumItems
Set itm = colResItems(I)
If Left(itm.MessageClass, 11) = "IPM.Contact" Then
NumContacts = NumContacts + 1
FullArray(NumContacts-1,1) = itm.LastName
FullArray(NumContacts-1,2) = itm.User1
FullArray(NumContacts-1,3) = itm.CompanyName
FullArray(NumContacts-1,4) = itm.User2
End If
Next

' Set the control to handle 4 data columns
Control.ColumnCount = 5

If NumItems = NumContacts Then
' They are all contacts, so use the FullArray
Control.List() = FullArray
Else
' There's some distribution lists, so use the smaller
' ConArray to eliminate extra blank values in the list box
Dim ConArray()
ReDim ConArray(NumContacts-1,2)
For I = 0 to NumContacts - 1
ConArray(I,1) = FullArray(I,1)
ConArray(I,2) = FullArray(I,2)
Next
Control.List() = ConArray
End If

End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
L Outlook 2007 Macro to Run a Script From a Contact Form Using Outlook 41
B Outlook Script ( using calendar function in a form) Outlook VBA and Custom Forms 3
D.Moore VB script to Digitaly Sign newly created outlook message Outlook VBA and Custom Forms 2
dweller Outlook 2010 Rule Ignores VBA Script Outlook VBA and Custom Forms 2
B Outlook rule run a Script doesn't work Outlook VBA and Custom Forms 1
K Outlook Archive to PST Files by Date Range VBA Script? Outlook VBA and Custom Forms 1
Vijay Run script doesn't work in outlook Using Outlook 1
F Avoid sending duplicate using Outlook script Outlook VBA and Custom Forms 2
oliv- How to Run a Script IN AN ADDIN with Outlook's Rules and Alerts Outlook VBA and Custom Forms 2
N Outlook script to forward emails based on senders' address Outlook VBA and Custom Forms 2
S using script rule to save attachments on arrival Outlook 2010 Outlook VBA and Custom Forms 9
X Outlook script to run excel data Outlook VBA and Custom Forms 1
N VBA Script to Send Automatic Emails from Outlook 2010 Outlook VBA and Custom Forms 1
D RUN SCRIPT WHEN OUTLOOK IS CLOSE Outlook VBA and Custom Forms 1
P How many subs can run in one outlook VBA script Using Outlook 5
J VBS Script (macro) for word to open Outlook template. Outlook VBA and Custom Forms 2
J Email Parsing VBA Script for Outlook - NEEDED Outlook VBA and Custom Forms 7
J VBS Script: How to execute in Outlook Outlook VBA and Custom Forms 8
Hudas Outlook VBA script reverting back to previous changes Outlook VBA and Custom Forms 2
J Outlook 2007 Rules & VBA: How to run a script on a report message (ReportItem) Using Outlook 14
M Outlook Rule To Redirect Mail - Script to overcome lack of cc's & others Using Outlook 0
C Outlook Script Error Using Outlook 0
S Outlook VBA rule script to process both MailItem and MeetingItem Using Outlook 0
L Limit VBA Script to one Outlook account Using Outlook 1
S Outlook 2010, need script for rules & Warnings Using Outlook 3
C Outlook 200? - Script Export Rules Using Outlook 1
R Change Outlook 2010 Exchange server address via registry or script Using Outlook 5
G Script Error message when trying to print e-mails using Outlook Mail Using Outlook 2
Aussie Rules Run a Script on an Incoming Email OK and then the Email reverts Outlook VBA and Custom Forms 0
D.Moore VBA script fail after Office 365 update Using Outlook 8
M Outlook 2013 Script Assistance - Save Opened Link with Subject Added Outlook VBA and Custom Forms 1
F Script for zip file attachment Outlook VBA and Custom Forms 1
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
Y Outlook 2013 Run A Script Outlook VBA and Custom Forms 4
Z Script to set account? Using Outlook 0
N VBA Script to Open highlighted e-mail and Edit Message Outlook VBA and Custom Forms 5
J Calling a Public sub-routine from the script editor via VB script Outlook VBA and Custom Forms 4
Peter H Williams Enable script containing VBA Outlook VBA and Custom Forms 12
A Script to fetch data from mails in restricted collection and sending them to excel Using Outlook 1
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
Bri the Tech Guy Registry Tweak to make "Run a Script" Action Available Outlook VBA and Custom Forms 2
V VB script code to save a specific email attachment from a given email Outlook VBA and Custom Forms 14
Bri the Tech Guy Run Script rule not running for newly arriving messages Outlook VBA and Custom Forms 25
M Subject Line Automation - Trigger Script Delayed Outlook VBA and Custom Forms 2
Q Script to create a pst file for Archiving Using Outlook 1
Vijay Error in rule- Run a script Using Outlook 1
R VBA Script Quick Parts Using Outlook 1
Q VBA Script to move item in secondary mailbox Outlook VBA and Custom Forms 2
Diane Poremsky Run a Script Rule: Send a New Message when a Message Arrives New Slipstick.com Articles 2
L Run a Script Rule doesn't work Using Outlook 5

Similar threads

Top