Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to automate work with Excel file that uses macroses and VBA controls and forms. In particular, Excel file has the button that invokes a new form when clicking on it. I can successfully access and get reference to the button, but fails to do this for the form My C# code: .... using Excel = Microsoft.Office.Interop.Excel using MSForm = Microsoft.Vbe.Interop.Forms; // start Excel and open the file Excel.Application oXL = new Excel.Application(); oXL.Visible = true; Excel.Workbook oWb = (Excel.Workbook)(oXL.Workbooks.Open(file,...)); Excel.Worksheet oSheet = (Excel.Worksheet)oWB.ActiveSheet; // get reference to the button by its VBA name - works successfully Excel.OLEObject obj1 = (Excel.OLEObject)(oSheet.OLEObjects("myButton")); MSForm.CommandButton requestButton = (MSForm.CommandButton)(obj1.Object); // emulate clicking the button and wait a little until the form appears .... // trying to get reference to the form that has appeared by its VBA name - get exception 0x800A03EC object myForm = oSheet.OLEObjects("myForm"); Question: How can I refer Excel's user form from my C# code? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel form. Need data extracted to spreadsheet each time a form co | Excel Discussion (Misc queries) | |||
Can a form made in Excel 2002 be converted into a fillable form? | Excel Discussion (Misc queries) | |||
Transfer data to form from Excel range upon loading of form. | Excel Programming | |||
form in excel to be attached to the emails address in the form upon sumission | Excel Programming | |||
Reference Access created form in excel | Excel Programming |