PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Selecting alternate mailboxes

Reply

Selecting alternate mailboxes

 
Thread Tools Rate Thread
Old 19-12-2007, 04:35 PM   #1
bhavin_85
Junior Member
 
Join Date: Dec 2007
Posts: 1
Trader Rating: (0)
Question Selecting alternate mailboxes


hey guys

Ive had a quick search around and couldnt find anything that was remotely close to what I need.

Ive written the following code to run as a macro to send select emails into a folder when the button is clicked on. However because this is my default mailbox in mt outlook I keep getting the error message I built in. How do I get outlook to look at a specific name mailbox instead of the default one?
Code:
Sub ActionedNFA() On Error Resume Next Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem Set objNS = Application.GetNamespace("MAPI") Set objInbox = objNS.GetDefaultFolder(olFolderInbox) Set objFolder = objInbox.Folders("1 Action Taken - no further action") 'Assume this is a mail folder If objFolder Is Nothing Then MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER" End If If Application.ActiveExplorer.Selection.Count = 0 Then 'Require that this procedure be called only when a message is selected Exit Sub End If For Each objItem In Application.ActiveExplorer.Selection If objFolder.DefaultItemType = olMailItem Then If objItem.Class = olMail Then objItem.Move objFolder End If End If Next Set objItem = Nothing Set objFolder = Nothing Set objInbox = Nothing Set objNS = Nothing End Sub


cheers guys
bhavin_85 is offline   Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off