Error: the operation failed - 800401f3 - controlling out of office from vbscript

378 Views Asked by At

I wrote a vbscript to be able to control Out-Of-Office (OOO) for somebody else. We are both in the same company, the same network. The code works flawlessly on my PC but on his it pops that error message:

error message

Here is the first lines of my code including the 44th (like in the error message):

Sub olOutOfOffice(ActivateOOO)

    Dim olApp
    Set olApp = WScript.CreateObject("Outlook.Application")

    Dim olNameSpace
    Set olNameSpace = olApp.GetNamespace("MAPI")

    Dim olFolder
    Set olFolder = olNameSpace.GetDefaultFolder(6)

    Dim olSession
    Set olSession = olApp.CreateObject("MAPI.Session") 'Line #44

    olSession.Logon "", "", False, False

Note that even though I do not use olNameSpace and olFolder in the rest of my script these lines Set olNameSpace... and Set olFolder... were necessary for that script to work on my PC. However, on my colleague's PC, removing those lines from the code pop the same error as when they are present.

0

There are 0 best solutions below