Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Why would you want to include the attachments in a reply? All recipients already have them, so it's a waste of resources...

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='783273' date='06-Jul-2009 23:52']Why would you want to include the attachments in a reply? All recipients already have them, so it's a waste of resources...[/quote]


    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)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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.
    Attached Files Attached Files

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts
    [quote name='HansV' post='783281' date='06-Jul-2009 16:45']See the code in the attached text file.[/quote]
    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]
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts
    [quote name='HansV' post='783273' date='06-Jul-2009 15:52']Why would you want to include the attachments in a reply? All recipients already have them, so it's a waste of resources...[/quote]
    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.
    -John ... I float in liquid gardens
    UTC -7ąDS

  7. #7
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='783281' date='07-Jul-2009 00:45']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.[/quote]

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •