Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Apr 2001
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script to save received messages (Outlook 2003 SP

    Hi,
    I receive some newsletters that I want to save as text or html in order to keep then outside of Outlook. I'm looking for some kind of plug-in or script that allows me to establish a rule that automatically save the messages to their folder (I mean Windows' folders, not Outlook's), with their subject as filename. If someone knows something about it, or want to help me with the script (my programming skills are close to null), I'll appreciate that.
    Best regards and thank you for your attention

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Script to save received messages (Outlook 2003

    Have a look at what is available from Ornic

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

    Re: Script to save received messages (Outlook 2003 SP

    This is some untested sample code. You will need to edit it as necessary for the newsletter sender names and path to save the file, then place it in the ThisOutlookSession module of Outlook's Visual Basic Editor (VBE), save the code, and close and restart Outlook. See posts <post#=398131>post 398131</post#> for more advice on using the VBE You can test and debug it by dragging old newsletters that you want saved into your default message Inbox. It will need some tuning to get an exact match to the newsletters you want to target. Post back with any problems.

    Option Explicit

    Public WithEvents itmsNewMessages As Outlook.Items

    Private Sub Application_Startup()
    Set itmsNewMessages = Outlook.Session.GetDefaultFolder(olFolderInbox).It ems
    End Sub

    Private Sub Application_Quit()
    Set itmsNewMessages = Nothing
    End Sub

    Private Sub itmsNewMessages_ItemAdd(ByVal Item As Object)
    ' enter the sender names of the newsletters in the quotes section here
    Const strNewsLetterNames As String = "server@letters.dailyblab.com, bob@listserver.notforprofit.org"
    ' enter the folder path for saving the messages here
    Const strPath As String = "Cocuments and SettingsusernameMy DocumentsNewsletters"
    Dim strSName As String, strMsgName As String

    If Item.Class = olMail Then
    With Item
    strSName = .SenderName
    If InStr(1, strNewsLetterNames, strSName, vbTextCompare) > 0 Then
    strMsgName = strPath & strSName & "_" & .Subject & "_" & _
    Replace(CStr(Int(.ReceivedTime)), "/", "-")
    .SaveAs strMsgName, olHTML
    ' .Delete ' remove the first quote if you want the newsletter deleted
    End If
    End With
    End If
    End Sub
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    New Lounger
    Join Date
    Apr 2001
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Script to save received messages (Outlook 2003

    Thank you both for such quick answers. I'll give a try and then I'll give some feedback.
    Best regards

Posting Permissions

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