Results 1 to 9 of 9
  1. #1
    Lounger
    Join Date
    Jan 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3)

    I was just reviewing the size of my Outlook Mail Folders and discovered that the largest folder is one in which I have many notes with PDF files attached. I like to save all correspondence, but in this case the PDFs have all been saved elsewhere on my machine. I'd like to simply detach the pdf files from the e-mails and delete them (as far as Outlook is concerned), thus reducing the size of my Outlook Mail Folders. I guess I can say the same about photos others send me and which I save in My Pictures. How to detach and delete them from the e-mails? Please advise how this can be done. Thank you.

    Tom

  2. #2
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,577
    Thanks
    5
    Thanked 1,057 Times in 926 Posts

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    Joe

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    Depending on your needs, and your interest in fiddling with code, you could adapt the macro I posted in this thread, which removes .MSG type attachments (embedded messages) and inserts at the bottom the names of the attachments it removed, but does not save those attachments to disk. Re: Saving email and attachment list (2002) .

  4. #4
    Lounger
    Join Date
    Jan 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    Thanks guys, but I find both solutions a little bit too technical.

    I had thought there would be a way to simply delete all attachments within a folder already built into Outlook.

    Tom

  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

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    Unfortunately, Tom, native Outlook does not support bulk deletion of attachments in multiple messages. For what you want JScher's solution is the best fit.
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    Lounger
    Join Date
    Jan 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    I haven't a clue as to what to do with his code, like what does one do with a macro, assuming that is a macro? Also, do I change "msg" to "pdf" in my case? And so on.

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    In Outlook, you can add a macro like so:

    (1) Press Alt+F11 to open the Visual Basic Editor
    (2) Use Insert > Module to create a new code module
    (3) Paste this into the blank module:

    <code>Sub AttachStripAndAnnotate()
    ' Jefferson Scher 3/8/07 based on RemoveRelayedMessageAttachment [rev. 11/14/2008]
    Dim msg As Outlook.MailItem, blnLoop As Boolean, intCounter As Integer, _
    strInsert As String, intSelCount As Integer
    blnLoop = False
    If Inspectors.Count > 0 Then
    ' Go to work on this "message" if it is a mail item
    If ActiveInspector.CurrentItem.Class <> olMail Then Exit Sub
    Set msg = ActiveInspector.CurrentItem
    Else
    ' Try to clean selected message(s)
    With ActiveExplorer
    Select Case .Selection.Count
    Case 0
    Exit Sub
    Case 1
    If .Selection(1).Class <> olMail Then Exit Sub
    Set msg = .Selection(1)
    Case Else
    blnLoop = True
    intSelCount = 1
    If .Selection(intSelCount).Class <> olMail Then Exit Sub
    Set msg = .Selection(intSelCount)
    End Select
    End With
    End If
    Do
    strInsert = vbNullString
    With msg.Attachments
    For intCounter = .Count To 1 Step -1
    If LCase(Right(.Item(intCounter).FileName, 4)) = ".msg" Then
    strInsert = strInsert & vbCrLf & .Item(intCounter).DisplayName & " {message item}"
    ElseIf LCase(.Item(intCounter).FileName) = LCase(.Item(intCounter).DisplayName) Then
    strInsert = strInsert & vbCrLf & .Item(intCounter).DisplayName
    Else
    strInsert = strInsert & vbCrLf & .Item(intCounter).DisplayName & _
    " {File name: " & .Item(intCounter).FileName & "}"
    End If
    .Item(intCounter).Delete
    Next
    End With
    If strInsert <> vbNullString Then
    If msg.BodyFormat = olFormatHTML Then 'Added 3/8/07
    If InStr(1, msg.HTMLBody, "</body>", vbTextCompare) > 0 Then
    msg.HTMLBody = Replace(msg.HTMLBody, "</body>", _
    "<p style=""border-style:double; border-width:3px; padding:4px 8px;"">" & _
    "Attachment(s) removed: " & vbCrLf & _
    Replace(strInsert, vbCrLf, "" & vbCrLf) & "</p></body>", , , vbTextCompare)
    Else
    msg.HTMLBody = msg.HTMLBody & _
    "<p style=""border-style:double; border-width:3px; padding:4px 8px;"">" & _
    "Attachment(s) removed: " & vbCrLf & _
    Replace(strInsert, vbCrLf, "" & vbCrLf) & "</p>"
    End If
    Else
    msg.Body = msg.Body & vbCrLf & vbCrLf & String(60, "=") & vbCrLf & _
    "Attachment(s) removed:" & vbCrLf & strInsert
    End If
    End If
    If msg.Saved = False Then msg.Save
    If blnLoop = False Then Exit Do
    intSelCount = intSelCount + 1
    With ActiveExplorer
    Do
    If .Selection(intSelCount).Class = olMail Then
    Set msg = .Selection(intSelCount)
    If .Selection.Count = intSelCount Then blnLoop = False
    Exit Do
    Else
    If .Selection.Count = intSelCount Then
    Set msg = Nothing
    Exit Sub
    End If
    intSelCount = intSelCount + 1
    End If
    Loop
    End With
    Loop
    Set msg = Nothing
    End Sub</code>

    To run the macro, open a message you want to strip of attachments, press Alt+F8, highlight the macro and run it.

    Warning: This macro may be a little over-enthusiastic for your purposes: it removes all "attachments" including embedded images. I haven't yet cracked the code on differentiating between different kinds of attachments.

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    You don't need to change anything in Jefferson's code. All attachments will be deleted regardless of attachment type; Word docs, Excel spreadsheets, embedded Messages, graphics, PDFs, anything that's an attachment will be removed. The only thing I would add, if it's not clear to you, is that if you have a message open, Jefferson's code will work on just that message, but if you are looking at a Folder, it operates on whatever messages you have selected in that Folder, and you can select one, or some, or all of the messages in a folder.
    -John ... I float in liquid gardens
    UTC -7ąDS

  9. #9
    Lounger
    Join Date
    Jan 2008
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Deleting Attachments from Saved Notes (Outlook 2003 (11.8217.8221) SP3

    Thank you all. I decided I wasn't cut out to use macros. I discovered, as you all probably know, that if I double click on a note and open it up I can right click on an attachment and there is a REMOVE option. So this gives me a way to proceed for all future notes with attachments. I can right click on an attachment (like a photo or pdf or doc file) and do a SAVE AS, and then, with the note opened up fully I can click on REMOVE and delete the attachment from the note and still hold onto the note in my folders for future reference.

    Of course I can go back at my leisure and do the same for notes previously received and stored in folders, thus reducing the size of all of my OUTLOOK DATA FILES.

    Thanks a lot for your ideas.

    Tom

Posting Permissions

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