Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clipboard paste to email

I am using some code to insert in an email the last clipboard print screen, but is there a way to choose the last 3 print screens? Or to choose multiple print screens to insert in the email? Thank you.

Sub clipboardcopy()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim olInsp As Object
    Dim oRng As Object


    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
        .To = ""
        .CC = ""
        .BCC = ""
        .Subject = "PRINT SCREEN"

        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
End Sub
like image 982
wittman Avatar asked Feb 01 '26 11:02

wittman


1 Answers

Sorry I don't think this is possible.

The standard Windows clipboard contains only 1 item at a time.

The Office clipboard contains multiple items, but isn't accessible via VBA.

like image 123
David Rushton Avatar answered Feb 03 '26 03:02

David Rushton