Error at runtime. Failure in attempted VBA Outlook operation

Asked

Viewed 347 times

0

I created a macro to run a routine in outlook. The code works perfectly on a PC, but when I replicate the code to another macro I get the following message:

Runtime error '-2147221233(8004010f) Attempted operation failed. Object not found

The error appears in the following excerpt:

Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")

'Erro aqui:
Set fol_CGR = ns.Folders(1).Folders("CGR")
Set fol_UDI = ns.Folders(1).Folders("UDI")

I have read several forums and found nothing similar. Someone can help me?

1 answer

0

The problem was solved by spelling out the default Folder address

Set fol_CGR = ns.Folders(1).Folders("Pasta")

Replaced by

Set fol_CGR = ns.Folders("[email protected]").Folders("CGR")

Browser other questions tagged

You are not signed in. Login or sign up in order to post.