If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > macro problem in outlook

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-25-11, 10:50
codee240 codee240 is offline
Registered User
 
Join Date: May 2011
Posts: 19
Question 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 ....
Reply With Quote
  #2 (permalink)  
Old 07-27-11, 15:54
christyxo christyxo is offline
Registered User
 
Join Date: Oct 2003
Location: London
Posts: 291
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 16:00.
Reply With Quote
Reply

Tags
outlook

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On