Results 1 to 2 of 2

Thread: Copy message to (public) folder

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    1

    Copy message to (public) folder

    Hi all,

    I'm a VBA newbie and would like to create an Outlook 2003 macro to copy a selected e-mail message in my inbox or sent items folder to a specific public folder. Can anyone give me a code snippet how to do this?

    Many thanks!

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Copy message to (public) folder

    this might at least start u in the right direction:

    this shows u how to grab the inbox.. and how to list all the folders in Public FOlders > All Public Folders

    VB Code:
    1. Public Function MoveMail(toFldr As String)
    2.     Dim FLD1 As MAPIFolder
    3.     Dim FLD2 As MAPIFolder
    4.     Dim FLDRS As MAPIFolder
    5.     Set FLD1 = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
    6.     Set FLD2 = Application.GetNamespace("MAPI").Folders("Public Folders").Folders("All Public Folders")
    7.     For Each FLDRS In FLD2.Folders
    8.         Debug.Print FLDRS.Name
    9.         DoEvents
    10.     Next
    11.  
    12.  
    13.  
    14. End Function
    15. Private Sub test()
    16.     MoveMail "Test"
    17.    
    18. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

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



Click Here to Expand Forum to Full Width