![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I keep getting a "one or more parameter values are not valid" on the
"objEmail.Move objFolder" line. I can move it to an inbox sub folder without error, and I can manually drag the item to the public folder without error. Any ideas on what's wrong here? (I have publishing author client permisions on the folder.) John Sub MoveSpam() 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("Test") 'Set objFolder = objNS.Folders("Public Folders").Folders("All Public Folders").Folders("GFI AntiSpam Folders").Folders("This is spam email") For intX = 1 To objNS.Folders.Count If objNS.Folders.Item(intX).Name = "Public Folders" Then Set objFolder = objNS.Folders.Item(intX).Folders("All Public Folders") Set objFolder = objFolder.Folders("GFI AntiSpam Folders") Set objFolder = objFolder.Folders("This is spam email") Exit For End If Next 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 Set oSelection = Application.ActiveExplorer.Selection 'intCount = oSelection.Count 'For i = intCount To 1 Step -1 ' Set objItem = oSelection.Item(i) ' If objFolder.DefaultItemType = olMailItem Then ' If objItem.Class = olMail Then ' objItem.Move objFolder ' End If ' End If ' 'objItem.Copy objFolder 'Next For intX = ActiveExplorer.Selection.Count To 1 Step -1 Set objX = ActiveExplorer.Selection.Item(intX) If objX.Class = olMail Then Set objEmail = objX objEmail.Move objFolder End If Next '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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help problems setting up rule to move email to a public folder | Dab | Outlook - General Queries | 0 | October 18th 06 01:09 AM |
Copy mail item to one folder and then move it to another folder | LDMueller | Outlook - Using Forms | 1 | September 15th 06 03:15 PM |
activate contact folder from public folder with "show this folder as email address book using a prf file | Frankie K. | Outlook - Using Contacts | 7 | July 25th 06 05:37 PM |
How i export/copy/move messages in a public folder outlook 2003? | Olatunde R. Adeniran | Outlook - Using Contacts | 1 | May 3rd 06 06:51 PM |
move to Outlook Folder | Hlewis | Outlook and VBA | 9 | March 27th 06 01:39 PM |