|problem after adding Macro [message #793]
||Tue, 08 August 2006 03:05
Registered: August 2006
I am developing a excel addin using c#
on click of a command bar button create a worksheetsheet and add a macro to
the workbook the following way
module = application.ActiveWorkbook.VBProject.VBComponents.Add(
module.Name = "Macro1";
i have also added a combo box to the work sheet whose OnAction property i
have set to the above added Macro - Macro1.
when the worksheet is created there is a cell which is selected and i try
typing something, but nothing types, it is as though no cell has been
selected and i am trying to type. Only in this case i actually have a cell
selected. (its wierd...its as if its hung)
Now i go ahead and click on the cell (reselect the cell by mouse) which was
selected and type again. This time it types. But now when i go and click on
the combo-box, the debug code window for the macro opens up and i see the
words i was trying to type before (and were not typed) in the macro code at
the bottom and so the macro actually had a problem executing.
i feel somehow after the macro was added using AddFromString thru C# code
the cursor was put in the Macro code window and after the addition it was
never returned to the excel workseet. Hence when i try to type it gets
written in the macro code window instead of the worksheet.
If anybody knows the problem plase help ...this is driving me crazy...