Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    May 2005
    Location
    Wilcox, Saskatchewan
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    removing certin attachment in outlook form from xl (Excel 2000)

    Hi,
    I bring forward a question which relates to Outlook and excel controlling a item. The Item/ post holds attachments. When i open one of the attachments thorugh my macro; I would like to delete this attachment So that I can post an updated one instead of making multiple copies which the code currently does. I have code that can call up the outlook form and count the attachments so I know I can get control of them but I am unable to figure out how to find the attachment I opened and delete the attachment. The attachments name is defined as a varible in my code "swbkname", Does anyone know of the code I would use to enter the oItem which is the item; look through the attachments, find the one called swbkname & ".xls" and remove it?

    Thank you,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: removing certin attachment in outlook form from xl (Excel 2000)

    With the oItem object from your code, you could use this:
    <code>
    Dim att As Attachments
    Dim i As Integer
    Set att = oItem.Attachments
    For i = 1 To att.Count
    If att(i).FileName = swbkname & ".xls" Then
    att.Remove i
    Exit For
    End If
    Next i</code>

  3. #3
    2 Star Lounger
    Join Date
    May 2005
    Location
    Wilcox, Saskatchewan
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: removing certin attachment in outlook form from xl (Excel 2000)

    Hey Hans,
    Thanks. I did have to change Set att = Dim att As Attachments to Dim att As Variant not sure why.

    it works good though thanks

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: removing certin attachment in outlook form from xl (Excel 2000)

    If you have a reference to the Microsoft Outlook 9.0 Library (in Tools | References...), you can use Dim ... As Outlook.Attachments, but if you don't have such a reference, you must use Dim ... As Object or Dim ... As Variant.

Posting Permissions

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