Execute VBA Macro via C# Interop?
Posted
by Jon Artus
on Stack Overflow
See other posts from Stack Overflow
or by Jon Artus
Published on 2009-01-09T16:56:25Z
Indexed on
2010/05/17
15:40 UTC
Read the original article
Hit count: 230
Hi all, just wondering if anyone could suggest why I might be getting an error? I'm currently trying to execute a macro in a workbook by calling the Application.Run method that the interop exposes.
It's currently throwing the following COM Exception:
{System.Runtime.InteropServices.COMException (0x800A03EC): Cannot run the macro Macro1'.
The macro may not be available in this workbook or all macros may be disabled.
I've put the containing workbook in a trusted location, set all of the security settings to their minimum values, and trusted programmatic access to my object model. I'm entirely out of ideas and Google's failed me so far!
Has anyone done this, or can you suggest anything which I could try?
Many thanks!
© Stack Overflow or respective owner