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!

Help with outlook form code

Status
Not open for further replies.

foz11

Technical User
Aug 20, 2007
6
0
0
GB
Im using the following

Function Item_Send()
Set myOLItem = Item
Set myPages = Item.GetInspector.ModifiedFormPages
myOLItem.Body ="[Client First Name]" + myPages("Message").Controls("Customerfirstname") + Chr(13) + _
"[Client Last Name]" + myPages("Message").Controls("Customerlastname") + Chr(13) + _
"[Payroll Number]" + myPages("Message").Controls("Users Payroll Number") + Chr(13) + _
"[Department]" + myPages("Message").Controls("Departmentdropdown")+ Chr(13) + _
"[Job Title]" + myPages("Message").Controls("Users Job Title")+ Chr(13) + _
"[Location]" + myPages("Message").Controls("Users Location")+ Chr(13) + _
"[Telephone]"+ myPages("Message").Controls("Users Telephone")+ Chr(13) + _
"[Similiar User]"+ myPages("Message").Controls("Similiar User")
"[Network Account]"+ myPages("Message").Controls("NetworkAccount")
"[Email Account]"+ myPages("Message").Controls("emailaccount")
End Function

but i keep getting expected statement on line 12 error, can anyone help?
 
adding that to each line give syntax error on line 14 which is the

End Function line
 
infact cancel that...i see you put + _ on every line apart from the last, sorry just picking this up now so il be back.

Cheers chance for quick reply
 
How about:
Code:
Function Item_Send()
  Set myOLItem = Item
  Set myPages = Item.GetInspector.ModifiedFormPages
    myOLItem.Body = "[Client First Name]" & myPages("Message").Controls("Customerfirstname") & Chr(13) & _
            "[Client Last Name]" & myPages("Message").Controls("Customerlastname") & Chr(13) & _
            "[Payroll Number]" & myPages("Message").Controls("Users Payroll Number") & Chr(13) & _
            "[Department]" & myPages("Message").Controls("Departmentdropdown") & Chr(13) & _
            "[Job Title]" & myPages("Message").Controls("Users Job Title") & Chr(13) & _
            "[Location]" & myPages("Message").Controls("Users Location") & Chr(13) & _
            "[Telephone]" & myPages("Message").Controls("Users Telephone") & Chr(13) & _
            "[Similiar User]" & myPages("Message").Controls("Similiar User") & Chr(13) & _
            "[Network Account]" & myPages("Message").Controls("NetworkAccount") & Chr(13) & _
            "[Email Account]" & myPages("Message").Controls("emailaccount")
            
End Function

Everybody body is somebodys Nutter.
 
that gives me

Forms.Form.1: Could not find the specified object.
 
This has been resolved now...i used CluelessChriss code and its working perfectly, one of my fields was named incorrectly since trying last time.

Thanks for all the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top