Consulting

Results 1 to 6 of 6

Thread: Transfering Custom Fields into Message

  1. #1
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location

    Transfering Custom Fields into Message

    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 .

  2. #2
    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

  3. #3
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    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 ...

  4. #4
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    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

  5. #5
    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
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  6. #6
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •