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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2003 Form - Copy text from text box to the message body

Status
Not open for further replies.

mefanning

MIS
Apr 26, 2010
19
US
My text box is named textbox1 and the value name is "text".

I get an error message - One or more parameter values are not valid.

Sub CommandButton1_Click

Dim strText
set strText = Item.UserProperties("TextBox1")
Item.To = "email@email.com"
Item.Subject = "This is the subject"
Item.Body = strText
Importance = 2 'High

End Sub

 
Actually, the error message is - object required Item.UserProperties(...)
 
So, where and how is Item instanciated ?


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the quick reply.

I believe Item is predefined by Outlook in their scripting editor. If I remove the lines to set strText and to populate item.body it works.

This is what I mean:

Sub CommandButton1_Click

Item.To = "email@email.com"
Item.Subject = "This is the subject"
Item.Body = "This is the body"
Importance = 2 'High

End Sub
 
What PHV is pointing out (at least from my interpretation) is where in the scope of the sub CommandButton1_Click is Item defined? From the sounds of it, you'll need to instanciate an Outlook object and then the Item object.

In fact, here's a reference to one of his older posts regarding a similar issue


-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top