Hello , I created custom form and i need when send it the value on custom fields will be place into on top section of my message . could you please help me how it possible ?
Thank you so much .
Hello , I created custom form and i need when send it the value on custom fields will be place into on top section of my message . could you please help me how it possible ?
Thank you so much .
You are going to have to explain the requirement in more detail. What sort of form? What do you mean by 'top section' in this context.
Graham Mayor - MS MVP (Word) 2002-2019
Visit my web site for more programming tips and ready made processes
http://www.gmayor.com
Hello Dear gmayor , Thanks for the quick reply
I created a field with user and text field and when want to send a new email if this field has value automatically will be placed on top of message .
For Example :
Hello Dear Sir ....
and i add #reply value in text field and when send email want to show like :
#reply
Hello Dear Sir ...
I used This code but the value in Company will be place after signature , i need placed in top of my message :
Function Item_Send() Item.Body = Item.Body & vbCrLf & Item.UserProperties("Company") End Function
Still no indication of where this 'field' is located, but with respect to your most recent message
will put the value before the body.Item.Body = Item.UserProperties("Company") & vbCrLf & Item.Body
If you want to edit the body you need to use the Word message editor e.g.
Sub Example() Dim olEmail As Outlook.MailItem Dim olInsp As Outlook.Inspector Dim wdDoc As Object Dim oRng As Object On Error Resume Next Set olEmail = ActiveInspector.CurrentItem With olEmail Set olInsp = .GetInspector Set wdDoc = olInsp.WordEditor Set oRng = wdDoc.Range(0, 0) 'oRng is the start of the message oRng.Text = olEmail.UserProperties("Company") & vbCr 'Your field result .Display .sEnd End With lbl_Exit: Set olEmail = Nothing Set olInsp = Nothing Set wdDoc = Nothing Set oRng = Nothing Exit Sub End Sub
Graham Mayor - MS MVP (Word) 2002-2019
Visit my web site for more programming tips and ready made processes
http://www.gmayor.com
Thank you so much , just for line break for custom filed what i must to do like ?
That mean line break between Company and User ?Function Item_Send() Item.Body = Item.UserProperties("Company") & Item.UserProperties("User") & Item.Body & vbCrLf End Function
Thanks for your great help.
I fixed it with
Thanks& vbNewLine &