Results 1 to 2 of 2

Thread: Pasting a range into an email, while also adding text to body and keeping signature

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,954
    Location
    Welcome to the forum!

    If you are going to use the WordEditor method, use it. It can be a bit tricky but provides a nice result. Plus, you are working in 3 Applications. While not all Word things are possible, many are. Record macros in Word and then adapt to WordEditor. Look at the code at the end for tips.

    WordEditor really gets tricky when you add a copy/paste OLEobject but it can be done.

    Otherwise, go with htmlBody method. https://www.rondebruin.nl/win/s1/outlook/signature.htm

    Normally, I just copy/paste in the content from a rtf file for the signature. PasteSpecial with InLine option is usually the best but Paste "may" work out ok.

    You can find one path to signature.rtf file as Ron shows at his site. That may or may not be your "default" signature.

    I can show a more complete example if needed. For your range Copy, you might find that CopyPicture method is the better choice.
    e.g.
    ' Tools > References > Microsoft Word xx.0 Object Library > OK 
    Dim Word As Document, wr As Word.Range, rTo As Recipient
    .GetInspector.Display
    Set Word = .GetInspector.WordEditor
    Word.Content = "Dear Sir, " & vbCrLf & vbCrLf & S & vbCrLf & vbCrLf & "Confirmation Attached" _
    & vbCrLf & vbCrLf & "Regards," & vbCrLf & "My name," & vbCrLf & "Firm name, & Contact detail.."
    ' Paste sig.rtf
    Set wr = Word.Range
    wr.Collapse Direction:=wdCollapseEnd
    ' Copy content from sig.rtf as signature for body of email to clipboard.
    GetObject(sig).Range.Copy
    wr.Paste
    Last edited by Aussiebear; 01-28-2025 at 03:22 AM.

Tags for this Thread

Posting Permissions

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