Log in

View Full Version : [SOLVED:] Transfering Custom Fields into Message



parscon
07-31-2015, 08:37 AM
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 .

gmayor
07-31-2015, 09:18 PM
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.

parscon
08-01-2015, 02:00 AM
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 ...

parscon
08-01-2015, 02:34 AM
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

gmayor
08-01-2015, 03:06 AM
Still no indication of where this 'field' is located, but with respect to your most recent message

Item.Body = Item.UserProperties("Company") & vbCrLf & Item.Body will put the value before the 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

parscon
08-01-2015, 03:13 AM
Thank you so much , just for line break for custom filed what i must to do like ?



Function Item_Send()
Item.Body = Item.UserProperties("Company") & Item.UserProperties("User") & Item.Body & vbCrLf
End Function


That mean line break between Company and User ?

Thanks for your great help.


I fixed it with


& vbNewLine &

Thanks