paste clipboard to outlook with vba

I am looking for a method to paste the contains of my clipboard to outlook using VBA.  I am able to open outlook, add a subject and body text but I am not able to paste my clipboards to the body. 

Can someone please help?

Thanks

Answer
Answer

Use the following instead

Dim OutApp As Object
Dim OutMail As Object
Dim olInsp As Object
Dim xlSheet As Worksheet
Dim wdDoc As Object
Dim oRng As Object
    Set xlSheet = ActiveWorkbook.Sheets("Unapproved")
    xlSheet.UsedRange.Copy

    On Error Resume Next
    Set OutApp = GetObject(, "Outlook.Application")
    If Err <> 0 Then Set OutApp = CreateObject("Outlook.Application")
    On Error GoTo 0
    
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
        .BodyFormat = 3
        .To = ""
        .CC = ""
        .BCC = ""
        .Subject = "Unapproved ECR's"
        Set olInsp = .GetInspector
        Set wdDoc = olInsp.WordEditor
        Set oRng = wdDoc.Range
        oRng.collapse 1
        oRng.Paste
        .Display
    End With
   
 
    Set OutMail = Nothing
    Set OutApp = Nothing
    Set olInsp = Nothing
    Set wdDoc = Nothing
    Set oRng = Nothing

Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

25 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 11, 2024 Views 15,768 Applies to: