Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011
    Posts
    19

    Question Unanswered: macro problem in outlook

    hello peeps,

    got a bit of an issue here,

    i am trying to use VBA in outlook and save a copy of e-mails coming in one of the folders in public folders to the local/network drives in a folder.

    been looking for some code to get a clue but no use, anyone can help please ....

  2. #2
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    This may work but I can't test it... for some reason I can't access the VBA editor on my outlook at home.

    Code:
    Private WithEvents Items As Outlook.Items
    
    Private Sub Application_Startup()
    
    Dim olApp As Outlook.Application
    Dim objNS As Outlook.NameSpace
    Set olApp = Outlook.Application
    Set objNS = olApp.GetNamespace("MAPI")
    Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
    
    End Sub
    
    Private Sub Items_ItemAdd(ByVal item As Object)
    
    Dim Msg As Outlook.MailItem
    
    If TypeName(item) = "MailItem" Then
       Set Msg = item
    End If
    
    MailItem.SaveAs ("FilePathHere", olHTML)
    
    End Sub
    You only need to change the File Path.
    Last edited by christyxo; 07-27-11 at 17:00.

Tags for this Thread

Posting Permissions

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