P
Paul
I was able to piece together from this groups help a macro that will copy an
item into a folder and them move the item to a 2nd folder. I know this is a
stupid question, but I need a macro that just moves item to a folder. So I
would think all I need to do is remove some of the lines from my current
macro, but I cannot figure out which one. All I want to do is move the items
in ObjFolder1.
If I could get some guidance on how to do this it would be greatly
appreciated.
Sub W7X80201()
Dim obj As Object
Dim I As Long
Dim Sel As Selection
Dim objFolder As Outlook.MAPIFolder
Dim objFolder1 As Outlook.MAPIFolder
Dim objInbox As Outlook.MAPIFolder
Dim objInbox1 As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objNS1 As Outlook.NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set objNS1 = Application.GetNamespace("MAPI")
'Assume these are mail folders
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders("Projects").Folders("City of
Scottsdale").Folders("W7X80201 - Airport - Seal Coat")
Set objInbox1 = objNS1.GetDefaultFolder(olPublicFoldersAllPublicFolders)
Set objFolder1 =
objNS1.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Phoenix").Folders("Jobs").Folders("NAI").Folders("W7X80201 - Airport - Seal Coat")
Set Sel = Application.ActiveExplorer.Selection
For I = Sel.Count To 1 Step -1
Set obj = Sel(I)
Select Case True
Case (TypeOf obj Is Outlook.MailItem), (TypeOf obj Is
Outlook.ReportItem)
Set objCopy = obj.Copy
obj.Move objFolder
objCopy.Move objFolder1
End Select
Next
End Sub
item into a folder and them move the item to a 2nd folder. I know this is a
stupid question, but I need a macro that just moves item to a folder. So I
would think all I need to do is remove some of the lines from my current
macro, but I cannot figure out which one. All I want to do is move the items
in ObjFolder1.
If I could get some guidance on how to do this it would be greatly
appreciated.
Sub W7X80201()
Dim obj As Object
Dim I As Long
Dim Sel As Selection
Dim objFolder As Outlook.MAPIFolder
Dim objFolder1 As Outlook.MAPIFolder
Dim objInbox As Outlook.MAPIFolder
Dim objInbox1 As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objNS1 As Outlook.NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set objNS1 = Application.GetNamespace("MAPI")
'Assume these are mail folders
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders("Projects").Folders("City of
Scottsdale").Folders("W7X80201 - Airport - Seal Coat")
Set objInbox1 = objNS1.GetDefaultFolder(olPublicFoldersAllPublicFolders)
Set objFolder1 =
objNS1.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("Phoenix").Folders("Jobs").Folders("NAI").Folders("W7X80201 - Airport - Seal Coat")
Set Sel = Application.ActiveExplorer.Selection
For I = Sel.Count To 1 Step -1
Set obj = Sel(I)
Select Case True
Case (TypeOf obj Is Outlook.MailItem), (TypeOf obj Is
Outlook.ReportItem)
Set objCopy = obj.Copy
obj.Move objFolder
objCopy.Move objFolder1
End Select
Next
End Sub