Solved

script to delete all attachments Outlook saves in the Temp OLK folder when Outlook closes.

Posted on 2006-06-24
7
759 Views
Last Modified: 2012-06-21
I would like a script which deletes all the attachments Outlook leaves behind in the OLK folder.  I would like the script or macro to run everytime Outlook closes.

Thanks
0
Comment
Question by:kapara
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 16976058
Hi kapara,

This code put into the ThisOutlookSession module did the trick for me:


Option Explicit

Private Sub Application_Quit()

    Dim TestPath As String
    Dim dic As Object
   
    Const TheFolder As String = "c:\Documents and Settings\username\Local Settings\Temporary Internet Files\OLKB0\"
   
    On Error Resume Next
   
    Set dic = CreateObject("Scripting.Dictionary")
   
    Do
        TestPath = Dir(TheFolder & "*.*")
        If TestPath <> "" And Not dic.Exists(TestPath) Then Kill TheFolder & TestPath
        If Err <> 0 Then
            dic.Add TestPath, TestPath
            Err.Clear
            MsgBox "Could not delete " & TestPath
        End If
    Loop Until TestPath = ""
   
    Set dic = Nothing
   
End Sub


Regards,

Patrick
0
 
LVL 76

Expert Comment

by:David Lee
ID: 16976368
This is a duplicate question.  kapara, you asked this same question several days ago in the Outlook area.
0
 
LVL 1

Author Comment

by:kapara
ID: 16976483
Looking to do this automatically to all users who log in.  I hit submit before addidng that last bit.

Thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Accepted Solution

by:
David Lee earned 20 total points
ID: 16976494
If you don't want to run the code from inside Outlook (e.g. as part of the shutdown process), then you could put the code I posted in the other question in a VBscript file and run it from a login or logout script.
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 16976513
David,

Sorry, I did not see the previous question, so I figured it was a new one :)

Regards,

Patrick
0
 
LVL 76

Expert Comment

by:David Lee
ID: 16976515
Hi, Patrick.

No problem.  Hope all is well with you.

-- David
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question