• Outlook Paste (Outlook)

    Author
    Topic
    #453460

    Please forgive me as this is the VERY first VB code I have ever tried to create. I am trying to simply create a macro and assign it to a button. The macro is simply opening a new e-mail, creating the send to, the subject, and a simple body text, then pasting something from the clipboard and then send. Not rocket science right?

    I get all aspects of this thing up until the PASTE function. Here is my current code, could someone tell me how to just execute a paste function? As always thank you for the help

    Sub CIS()
    Dim msg As Outlook.MailItem
    Set msg = Application.CreateItem(olMailItem)
    msg.To = “testemail@helpme.com”
    msg.Subject = “This is the subject”
    msg.Body = “I will put the body text here”

    ***this is where I am stuck*******

    msg.Send

    End Sub

    Viewing 0 reply threads
    Author
    Replies
    • #1123042

      I assume that you want to paste something from the clipboard into the body of the e-mail.
      Do the following in the Visual Basic Editor:
      – Select Insert | UserForm.
      – You can discard the userform immediately, it won’t be needed any more.
      – We only needed it to be able to use a certain object.
      – Replace the line

      msg.Body = “I will be the body text here”

      with

      Dim objData As New DataObject
      objData.GetFromClipboard
      msg.Body = “This is the body text. ” & objData.GetText

      You can customize this, of course.

    Viewing 0 reply threads
    Reply To: Outlook Paste (Outlook)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: