Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to move Outlook items fo pst folders via VBA

Status
Not open for further replies.

anotherview

Programmer
May 9, 2009
1
US
This VBA code for Outlook 2003 works:

Code:
Sub movetoanotherfolder()

    Set myOlApp = CreateObject("Outlook.Application")
    Set myNamespace = myOlApp.GetNamespace("MAPI")
    Set myInbox = myNamespace.GetDefaultFolder(olFolderInbox)

    For Each currentMessage In myOlApp.ActiveExplorer.Selection
        currentMessage.Move (myInbox.Folders("psttest"))
    Next

End Sub

It moves the selected message (or item) to the psttest folder which is in the inbox folder of the server exchange mailbox folder.

However, I want to move it to a folder in a pst file. I have tried and tried and can't figure out how to designate a folder outside of the server exchange mailbox folder as the target folder.

I have a lot of Excel VBA experience, but not much in Outlook.

Thank you in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top