J
JJ
I am trying to have Access automate a procedure of moving an email in one
folder to another folder in Outlook. I know this can be done strictly through
Outlook, but I would like to have it automated with the rest of the procedure
I have already developed. I might have some problems with opening the second
folder too. I have used the Microsoft help library to come up with this
code....it doesn't seem to work....
Function moveemail()
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = _
myNameSpace.GetDefaultFolder(olFolderInbox)
Set myNewFolder = myFolder.Folders("FirstFolder")
Set myFirstItem = myNewFolder.Items.Item(1)
myFirstItem.Cut
Set myNewFolder = myFolder.Folders("SecondFolder")
myFirstItem.Paste
End Function
folder to another folder in Outlook. I know this can be done strictly through
Outlook, but I would like to have it automated with the rest of the procedure
I have already developed. I might have some problems with opening the second
folder too. I have used the Microsoft help library to come up with this
code....it doesn't seem to work....
Function moveemail()
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = _
myNameSpace.GetDefaultFolder(olFolderInbox)
Set myNewFolder = myFolder.Folders("FirstFolder")
Set myFirstItem = myNewFolder.Items.Item(1)
myFirstItem.Cut
Set myNewFolder = myFolder.Folders("SecondFolder")
myFirstItem.Paste
End Function