Macro in Excel

S

shree

I read an Excel workbook from C# code and want to know whether there
exist a macro in it or not. Can someone give me pointer how can I find
it.

THanks,
Shrish
 
M

MK

The file is opened in the binary mode, and the existence of the following
values is checked.

56 42 5F 4E 61 6D
 
S

shree

Actually I am trying to use the following code:
I am having an exception while adding an Excel Macro using C#. I use the
following code to check for a macro.

1. Excel.Application xl = null;
2. Excel._Workbook wb = null;
3. Excel._Worksheet sheet = null;
4. VBIDE.VBComponent module = null;
5. string Macro = "assing a macro"; //to be done
6. xl = new Excel.Application();
7. xl.Visible = false;

8. wb = (Excel._Workbook)(xl.Workbooks.Add( Missing.Value ));
9. sheet = (Excel._Worksheet)wb.ActiveSheet;
10. module =
wb.VBProject.VBComponents.Add(VBIDE.vbext_ComponentType.vbext_ct_StdModule);

Line number 10 throws an exception of type
System.Runtime.InteropServices.COMException with the message: Exception from
HRESULT: 0x800A03EC

I have Excel 2003 installed on my system. Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top