- Joined
- Mar 23, 2016
- Messages
- 1
- Reaction score
- 0
Hi
I have made some code in Outlook that will monitor all incoming emails on a common mail account.
If an incoming email is meeting certain criteria’s, the email will be moved to a specific folder.
We are several users that are running this code on the same email account. The problem occurs if the code start on the same email on one users Outlook, before another person Outlook is finished with the code.
The .move command will then make a copy of the email instead of moving.
I have found a way to trap the error, so the user is not presented with the error message. But the problem is that the .move command will make a copy, and I do not want that to happen.
Any suggestion to how I should structure the code so that it will work in a multiuser evironment
Here is part of the code
_________________________________________________
Public Sub DokumentSenter(FaktMail As Object)
Dim BackupFolder As Outlook.Folder
Dim gnspNameSpace As Outlook.NameSpace
Set gnspNameSpace = Outlook.GetNamespace("MAPI") 'Outlook Object
Set BackupFolder = gnspNameSpace.Folders("Merverdi Faktura").Folders("Inbox").Folders("BackupFaktura")
On Error GoTo ErrHandler
FaktMail.Move BackupFolder
Slutt:
Exit Sub
ErrHandler:
Call SkrivTilHyperion(FaktMail, "ErrHandler Dok.Senter")
Resume Slutt
End Sub
______________________________________
Regards
Jørn-Herbrand
I have made some code in Outlook that will monitor all incoming emails on a common mail account.
If an incoming email is meeting certain criteria’s, the email will be moved to a specific folder.
We are several users that are running this code on the same email account. The problem occurs if the code start on the same email on one users Outlook, before another person Outlook is finished with the code.
The .move command will then make a copy of the email instead of moving.
I have found a way to trap the error, so the user is not presented with the error message. But the problem is that the .move command will make a copy, and I do not want that to happen.
Any suggestion to how I should structure the code so that it will work in a multiuser evironment
Here is part of the code
_________________________________________________
Public Sub DokumentSenter(FaktMail As Object)
Dim BackupFolder As Outlook.Folder
Dim gnspNameSpace As Outlook.NameSpace
Set gnspNameSpace = Outlook.GetNamespace("MAPI") 'Outlook Object
Set BackupFolder = gnspNameSpace.Folders("Merverdi Faktura").Folders("Inbox").Folders("BackupFaktura")
On Error GoTo ErrHandler
FaktMail.Move BackupFolder
Slutt:
Exit Sub
ErrHandler:
Call SkrivTilHyperion(FaktMail, "ErrHandler Dok.Senter")
Resume Slutt
End Sub
______________________________________
Regards
Jørn-Herbrand