Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having an exception while adding an Excel Macro using C#. I use the
following code to add 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_Componen tType.vbext_ct_StdModule); 11. module.CodeModule.AddFromString(Macro); Line number 10 throws an exception of type System.Runtime.InteropServices.COMException with the message: Exception from HRESULT: 0x800A03EC Can someone give an idea what I am doing wrong here. thanks, Shrish |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding strings using macros | Excel Worksheet Functions | |||
Adding macros to toolbars | Excel Discussion (Misc queries) | |||
ex.=($B$4+C4) in macros for row why adding rest | Excel Worksheet Functions | |||
ex.=($B$4+C4) in macros for row why adding rest | Excel Worksheet Functions | |||
Adding buttons with macros | Excel Programming |