Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB with outlook forms problem

Status
Not open for further replies.

darian

Programmer
Feb 29, 2000
9
0
0
US
Can anyone tell me why the code below is giving me this error?<br>
<br>
Could not complete the operation. One or more parameter values are not valid.<br>
<br>
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.<br>
<br>
----StartCode----<br>
<br>
Option Explicit<br>
<br>
'<br>
' Send only to the first person in the To field,<br>
' Save other people in the To field into the RouteTo field.<br>
'<br>
Function Item_Send()<br>
Dim i<br>
Dim bDelete<br>
Dim prpRouteTo<br>
i = InStr(Item.To, &quot;;&quot;)<br>
If i = 0 Then<br>
i = InStr(Item.To, &quot;,&quot;)<br>
End If<br>
If i Then<br>
Set prpRouteTo = Item.UserProperties(&quot;RouteTo&quot;)<br>
prpRouteTo.Value = Mid(Item.To, i + 1)<br>
bDelete = False<br>
i = 1<br>
While i &lt;= Item.Recipients.Count<br>
If Recipients.Item(i).Type = 1 Then ' olTo<br>
If bDelete Then<br>
Recipients.Item(i).Delete<br>
Else<br>
i = i + 1<br>
bDelete = True<br>
End If<br>
Else<br>
i = i + 1<br>
End If<br>
Wend<br>
Else<br>
Set prpRouteTo = Item.UserProperties(&quot;RouteTo&quot;)<br>
prpRouteTo.Value = &quot;&quot;<br>
End If<br>
End Function<br>
<br>
'<br>
' Route message to people in the RouteTo field<br>
'<br>
Function Item_CustomAction(ByVal Action, ByVal NewItem)<br>
Dim prpRouteTo<br>
Dim i<br>
Select Case Action.Name<br>
Case &quot;Route&quot;<br>
Set prpRouteTo = NewItem.UserProperties(&quot;RouteTo&quot;)<br>
If prpRouteTo.Value &lt;&gt; &quot;&quot; Then<br>
Item_CustomAction = True<br>
NewItem.To = prpRouteTo.Value<br>
prpRouteTo.Value = &quot;&quot;<br>
Else<br>
Item_CustomAction = False<br>
End If<br>
Case Else<br>
Item_CustomAction = True<br>
End Select<br>
End Function<br>
<br>
Sub cmdProcess_Click<br>
If Item.UserProperties(&quot;Accounting Main Menu Checkbox&quot;) = True AND<br>
Item.UserProperties(&quot;EQP&quot;) = True Then<br>
Item.UserProperties(&quot;Group Code&quot;) = &quot;LL096&quot;<br>
Item.To = &quot;<A HREF="mailto:bo@schmo.com">bo@schmo.com</A>;<A HREF="mailto:joe@schmo.com">joe@schmo.com</A>&quot;<br>
Item.UserProperties(&quot;Progress Field&quot;) = &quot;Finished&quot;<br>
Else<br>
Item.UserProperties(&quot;Group Code&quot;) = &quot;LL095&quot;<br>
Item.To = &quot;<A HREF="mailto:john@doe.com">john@doe.com</A>&quot;<br>
Item.UserProperties(&quot;Progress Field&quot;) = &quot;Finished&quot;<br>
End If<br>
End Sub<br>
<br>
----EndCode---- <p>Stanley<br><a href=mailto:webmaster@glass-images.com>webmaster@glass-images.com</a><br><a href= Images</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top