• Outlook Reply-to-All with attachments – different??

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Outlook Reply-to-All with attachments – different??

    Author
    Topic
    #461012

    I’d like to get some code to do a Reply-to-All with attachments. Searched the net and only see code for the (in my humble opinion) less obvious of the two possibilities.

    What I see is code that does a reply to all and then takes all attachments from the original email; temporarily saves then to the HD and then adds them to the Reply-to-all email just created.

    Possible, I admit but as said, it does seem the difficult way to me…

    Why can’t I find code that instead does a simple Forward of the email and then reads the To: and CC: fields and re-adds these (together with the sender’s email from the From: field) to the new email. Here the email program (Outlook 2003 (!) in my case) takes care of the difficult work (the attachments) and the code simply does what many people do manually sometimes: re-adding the names to the new email.
    To make things “complete”, the code could then even change the subject line and remove the “FW:” and then add the “Re:”

    Has this been done?

    Viewing 0 reply threads
    Author
    Replies
    • #1167833

      Why would you want to include the attachments in a reply? All recipients already have them, so it’s a waste of resources…

      • #1167836

        Why would you want to include the attachments in a reply? All recipients already have them, so it’s a waste of resources…

        Yep, I expected that one (but I still want to know and do it )…

        One of my reasons is that often the first mail has an attachment; then a lively discussion starts and the thread is getting longer and longer. All participants however only have the original attachment in their first email. For years, I’ve been dreaming about a tool (there were times when I wanted to make one myself but I simply don’t have the time -nor probably the knowledge-) that could process my Inbox and/or PersonalFolders and automatically delete all emails in a thread that are already included in an answer.
        As and example; the Woody’s database could delete your answer now as it is quoted in this response.
        In the end, all that one needs is the last email in the thread that has the full discussion PLUS (and there comes the reason for my question) the original attachment. All other emails may be deleted then and no information is lost.

        I actually found two tools that can process threads like this: “DupeDuster” which is frozen in a limited state of functionality and doesn’t really work well and “DDO” (Delete Duplicates for Outlook, option “pseudo duplicates”). The latter is great (but I have some problems with my Personal Folders).

        (Oh… and I’m not too nervous about email resources: storage is peanuts compared to capacity and disk capability. Traffic is less and less a problem. All of this doesn’t mean I disagree with your statement however… it’s true but I’d still like to find out if this can be done)

        • #1167858

          See the code in the attached text file. It uses the Reply To address, not the From address. The code to get the Reply To address is from To get the sender’s address from a Microsoft Outlook mail message (code samples).
          Much of the code for the Reply2AllWithAttachments macro has been copied shamelessly from JohnBF’s attachment removal manager.

          • #1167925

            See the code in the attached text file.

            Speaking of which, JohnBF has his own Reply with Attachments code, which he has been using personally for some time but never posted. The code uses the technique that ErikJan does NOT want to use – that of saving the attachments to a temporary location and adding them back, because though you may not like it, ErikJan, it’s simple to code. The first two subs are hooked to the respective buttons. I may have shamelessly copied these from outlookcode.com myself:

            [codebox]Sub ReplySender()
            Call ReplyWithAttachments(False)
            End Sub

            Sub ReplyAll()
            Call ReplyWithAttachments(True)
            End Sub

            Function ReplyWithAttachments(boolReplyAll As Boolean) As Boolean
            Dim objMessage As Outlook.MailItem, objReply As Outlook.MailItem
            Dim lngUserSel As Long

            On Error Resume Next
            If TypeName(Application.ActiveWindow) = “Explorer” Then
            Set objMessage = ActiveExplorer.Selection(1)
            Else
            Set objMessage = ActiveInspector.currentitem
            End If

            If Not objMessage Is Nothing Then
            If boolReplyAll Then
            Set objReply = objMessage.ReplyAll
            Else
            Set objReply = objMessage.reply
            End If
            If CBool(objMessage.Attachments.Count) Then
            lngUserSel = MsgBox(“Include Attachments?”, vbYesNoCancel)
            If lngUserSel = vbYes Then
            CopyAttachments objMessage, objReply
            ElseIf lngUserSel = vbCancel Then
            GoTo CLEANUP:
            End If
            End If
            objReply.Display
            End If

            CLEANUP:
            Set objMessage = Nothing
            Set objReply = Nothing
            End Function

            Private Sub CopyAttachments(objSourceItem, objTargetItem)
            Dim fso As Object, fldTemp As Object
            Dim objAtt As Attachment
            Dim strPath As String, strFile As String

            Set fso = CreateObject(“Scripting.FileSystemObject”)
            Set fldTemp = fso.GetSpecialFolder(2)
            strPath = fldTemp.Path & “”
            For Each objAtt In objSourceItem.Attachments
            strFile = strPath & objAtt.FileName
            objAtt.SaveAsFile strFile
            objTargetItem.Attachments.Add strFile, , , objAtt.DisplayName
            fso.DeleteFile strFile
            Next

            Set fldTemp = Nothing
            Set fso = Nothing
            End Sub[/codebox]

          • #1168493

            See the code in the attached text file. It uses the Reply To address, not the From address. The code to get the Reply To address is from To get the sender’s address from a Microsoft Outlook mail message (code samples).
            Much of the code for the Reply2AllWithAttachments macro has been copied shamelessly from JohnBF’s attachment removal manager.

            Tested it and it works (I do need to resolve the email entries but that works OK). UPDATE: I added: fwd.Recipients.ResolveAll , now all works!

            Thanks!

      • #1167928

        Why would you want to include the attachments in a reply? All recipients already have them, so it’s a waste of resources…

        Because if you don’t mess it up, you can edit the file without saving it to drive, and send the edited one back. I know, I know, there are dangers in doing this, but I have done it thousands of times and lost my work no more than a dozen times. I have lost more work due to version control errors with files on drive than I ever have with editing files which are Outlook Attachments.

    Viewing 0 reply threads
    Reply To: Outlook Reply-to-All with attachments – different??

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

    Your information: