Calling Outlook Macro from Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there

I know should probaly be in the Excel forum but i got no response there.
I need to call a macro in outlook from excel to disable the item add event
handling.
Is this possible.

Thanks in advance
Stuart
 
You can't disable the Item_Add event. If you are controlling a public
folder, use permissions to prevent people from creating items unless they are
authorized.
 
I am declaring Private WithEvents olInboxItems As Items
and then traapping the Item_Add event for olInboxItems when a new email
arrives.
If i set olInbox to nothing then the procedure won't fire when new email
arrives and i am wondring if it is poosible to call a macro in Outlook from
Excel to do this.

Thanks
Stuart
 
Sorry, I'm not clear on what exactly you are trying to do. As I mentioned in
my previous post, you cannot stop e-mails from being delivered to the Inbox
(or any folder) using the Item_Add event. What you can do is delete every
one that is saved/arrives, but the Item_Add event won't fire if a large
number of items are added/delivered to the folder at once, and this approach
is obviously dangerous and not recommended

Your best bet is to write an Exchange Event Sink for intercepting e-mails
before they are delivered to your Inbox.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/
 
Hi

What i want to do in Outlook i know i can do and i think i am confusing you
here but what i want to know is can i call the macro in Outlook from Excel
VBA.

In outlook i am not trying to stope email comming in but i want to disable
the code that runs everytime an email arrives.

Thanks
Stuart
 
If you have code in the Item_Add event already, you cannot prevent it from
firing from Excel. You would either have to remove the code or add
additional logic to do whatever you want to do at that point, but you could
not prevent e-mails from being delivered.

If you have a procedure in the ThisOutlookSession module, you can call it
from an external automation point by using Application.<procedure name> (the
Outlook Application object), but this method is not officially supported.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/
 
Back
Top