custom form failed to open on outlook 2010

  • Thread starter p.andrew
  • Start date Views 565
Status
Not open for further replies.
P

p.andrew



Hi there,

We have created a custom form (created with VBscript) that works ok with outlook 2003 and 2007.

here's how it works:
someone open up the form and fills in the details, send to the authorized officer the officer will then open up the form and decides whether to APPROVE or DENY if DENY, send notification to sender if APPROVE, forward the form to a contact called "Purchase Requests Approval"
but for Outlook 2010 client, this will return an error similar to this:

Item can't be opened due to invalid e-mail account

Any idea?

Below is the script:

Option Explicit

'
' Send only to the first person in the To field,
' Save other people in the To field into the RouteTo field.
'
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
Item.UserProperties("RouteTo") = Item.UserProperties("RouteTo") + ";Purchase Requests Approval"
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 "APPROVE"
Set prpRouteTo = NewItem.UserProperties("RouteTo")
If instr(prpRouteTo,"Purchase Request Approval") = 2 AND Item.UserProperties.find("Software").value = True then
newitem.cc = "helpdesk@domain.com"
End If
If prpRouteTo.Value <> "" Then
Item_CustomAction = True
NewItem.To = prpRouteTo.Value
prpRouteTo.Value = ""
Item.Delete
Else
Item_CustomAction = False
End If
Case "DENY"
NewItem.Body = "Your purchase request that started with " & item.userproperties.find("OrderQuantity1") & " " & item.userproperties.find("ItemRequested1") & " has been denied"
Item.Delete
Case Else
Item_CustomAction = True
End Select
End Function

 
Status
Not open for further replies.
Top