1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

MS Outlook 2003 copy macro

Discussion in 'Business Applications' started by Daivana, Jan 25, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. Daivana

    Daivana Thread Starter

    Joined:
    Jan 25, 2011
    Messages:
    3
    Hello! I have this macro assigned to a custom button so I would faster copy an email in to the clipboard, but the thing is, it makes a copy to the whole e-mail even when there are reply's in it, but what I need is that this macro makes a copy from the last reply and not more. Could someone please help me to advance the code below.


    Code:
    Sub CopyMessageToClipboard()
        Dim objSelectedItems As Outlook.Selection, _
            objItem As MailItem, _
            strBuffer As String, _
            objData As New DataObject
        Set objSelectedItems = Application.ActiveExplorer.Selection
        For Each objItem In objSelectedItems
            If objItem.Class = olMail Then
                strBuffer = "From: " & objItem.SenderEmailAddress & _
                    vbCrLf & "To: " & objItem.To & _
                    vbCrLf & "Sent: " & objItem.SentOn & _
                    vbCrLf & "Subject: " & objItem.Subject & _
                    vbCrLf & "Body: " & objItem.Body
                objData.SetText strBuffer
                objData.PutInClipboard
            End If
        Next
        Set objItem = Nothing
        Set objSelectedItems = Nothing
        Set objData = Nothing
    End Sub
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Are each of the replies seperated by the phrase "-----Original Message-----" or something similar? If so you just need to set a variable equal to the message body and then use the left or mid function in VBA to seperate the last response.

    Can you post a sample email?

    Rollin
     
  3. Daivana

    Daivana Thread Starter

    Joined:
    Jan 25, 2011
    Messages:
    3
    Below is an example.
    What I need is, that the macro gets not the whole conversation but just the last sent mail from me or the last mail I got from someone.
    I need this because I have to copy each reply or mail in helpdesk to keep records.






     
  4. Daivana

    Daivana Thread Starter

    Joined:
    Jan 25, 2011
    Messages:
    3
    anyone?
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/976830

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice