Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VB with outlook forms problem

VB with outlook forms problem

VB with outlook forms problem

Can anyone tell me why the code below is giving me this error?

Could not complete the operation. One or more parameter values are not valid.

The code below is used behind a form used in MS Outlook. The form is filled in by a user and then sent on to the proper personel one by one. However after the user sends it on the the next person is unable to send it from their email as they get the above error. Thanks for any help.


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
i = i + 1
bDelete = True
End If
i = i + 1
End If
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 = ""
Item_CustomAction = False
End If
Case Else
Item_CustomAction = True
End Select
End Function

Sub cmdProcess_Click
If Item.UserProperties("Accounting Main Menu Checkbox") = True AND
Item.UserProperties("EQP") = True Then
Item.UserProperties("Group Code") = "LL096"
Item.To = "bo@schmo.com;joe@schmo.com"
Item.UserProperties("Progress Field") = "Finished"
Item.UserProperties("Group Code") = "LL095"
Item.To = "john@doe.com"
Item.UserProperties("Progress Field") = "Finished"
End If
End Sub


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close