Custom Forms in Outlook 2003

M

Mark

I have created a custom form in Outlook 2003 for new hires. The problem I am
running into is that I want to route the form so it will automatically go to
the next person on the list. When I choose route it doesn't route. Does
anyone have any links on where I can find some current code for Outlook 2003?
The only code I found for routing Forms is for an old version of Outlook.
 
S

Sue Mosher [MVP-Outlook]

Code for old versions should work with the latest. Not that much has
changed. Note, however, that code runs only on published forms.
 
M

Mark

This is published to the organization forms library and used the old code. I
get the route button but it still allows the users to add people to the list
instead of only forwarding it on to the next user on the list.
 
S

Sue Mosher [MVP-Outlook]

Could you show the code that is supposed to prevent that behavior?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

Mark

Here is the code I found online.

Function Item_Send()
Dim i
Dim bDelete
Dim prpRouteTo
i = InStr(Item.To, ";")
If i = 0 Then
i = InStr(Item.To, ",")
End If
If i Then
Set prpRouteTo = Item.UserProperties("RouteTo")
prpRouteTo.Value = Mid(Item.To, i + 1)
bDelete = False
i = 1
While i <= Item.Recipients.Count
If Recipients.Item(i).Type = 1 Then ' olTo
If bDelete Then
Recipients.Item(i).Delete
Else
i = i + 1
bDelete = True
End If
Else
i = i + 1
End If
Wend
Else
Set prpRouteTo = Item.UserProperties("RouteTo")
prpRouteTo.Value = ""
End If
End Function

'
' Route message to people in the RouteTo field
'
Function Item_CustomAction(ByVal Action, ByVal NewItem)
Dim prpRouteTo
Dim i
Select Case Action.Name
Case "Route"
Set prpRouteTo = NewItem.UserProperties("RouteTo")
If prpRouteTo.Value <> "" Then
Item_CustomAction = True
NewItem.To = prpRouteTo.Value
prpRouteTo.Value = ""
Else
Item_CustomAction = False
End If
Case Else
Item_CustomAction = True
End Select
End Function
 
S

Sue Mosher [MVP-Outlook]

The expressions using Recipients.Item(i) should be Item.Recipients.Item(i)
instead.

This statement

If i Then

I think should be

If i > 0 Then

Is the Route action on the (Actions) page set to use the same published
form?
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
M

Mark

The route action is correct, the strangest thing is that our guys in a
different office said it is working fine. Maybe it was just a replication
issue.

Thanks for the help.
 
Top