Sub MoveFolders()
Dim olNS As Outlook.NameSpace
Dim olSourceFolder As Outlook.Folder
Dim olTargetFolder As Outlook.Folder
Dim olSubFolder As Outlook.Folder
Dim i As Long
Set olNS = GetNamespace("MAPI")
Set olSourceFolder = olNS.Folders("XXXXXX@gmail.com").Folders("Inbox")
Set olTargetFolder = olNS.Folders("ZZZZZZ@gmail.com").Folders("Inbox")
For i = olSourceFolder.Folders.Count To 1 Step -1
Set olSubFolder = olSourceFolder.Folders(i)
olSubFolder.MoveTo olTargetFolder
Next i
lbl_Exit:
Set olNS = Nothing
Set olSourceFolder = Nothing
Set olTargetFolder = Nothing
Set olSubFolder = Nothing
Exit Sub
End Sub
Dim olNS As Outlook.NameSpace
Dim olSourceFolder As Outlook.Folder
Dim olTargetFolder As Outlook.Folder
Dim olSubFolder As Outlook.Folder
Dim i As Long
Set olNS = GetNamespace("MAPI")
Set olSourceFolder = olNS.Folders("XXXXXX@gmail.com").Folders("Inbox")
Set olTargetFolder = olNS.Folders("ZZZZZZ@gmail.com").Folders("Inbox")
For i = olSourceFolder.Folders.Count To 1 Step -1
Set olSubFolder = olSourceFolder.Folders(i)
olSubFolder.MoveTo olTargetFolder
Next i
lbl_Exit:
Set olNS = Nothing
Set olSourceFolder = Nothing
Set olTargetFolder = Nothing
Set olSubFolder = Nothing
Exit Sub
End Sub