问题
I am trying to move emails from the inbox in a secondary Outlook account to a sub-folder in that account.
Sub newBox()
Dim myInbox As Outlook.Folder
Dim myDestFolder As Outlook.Folder
Dim myItems As Outlook.Items
Dim myItem As Object
Dim i As Integer
Set myInbox = Session.Folders("Secondary").Folders("Inbox")
Set myDestFolder = myInbox.Parent.Folders("Complete")
End Sub
When I try to set the destination, myDestFolder
, I get
Run-Time error, An object could not be found.
回答1:
You navigated the folder tree from Secondary to Inbox then back to myInbox.Parent
which is Secondary.
In your answer post you changed to
Set myDestFolder = Session.Folders("Secondary").Folders("Inbox").Folders("Complete")
This indicates the Complete folder is immediately under the Inbox.
Sub newBox()
Dim myInbox As Folder
Dim myDestFolder As Folder
Set myInbox = Session.Folders("Secondary").Folders("Inbox")
Set myDestFolder = myInbox.Folders("Complete")
End Sub
回答2:
Figured it out
Set myDestFolder = Session.Folders("Secondary").Folders("Inbox").Folders("Complete")
来源:https://stackoverflow.com/questions/58031641/access-sub-folder-in-secondary-email-account