0

i want click on button in excel File with "Microsoft.Office.Interop.Excel". with following code just do select cell but Not clicked

        Microsoft.Office.Interop.Excel.Application ExcelApp = (Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject("Excel.Application");
        Microsoft.Office.Interop.Excel.Workbook book = ExcelApp.ActiveWorkbook;
        Microsoft.Office.Interop.Excel.Worksheet sheet = book.ActiveSheet;
        Microsoft.Office.Interop.Excel.Range ExcelRange = sheet.get_Range("A4");
        ExcelRange.Select();

How to click button?

mahdi0000
  • 7
  • 3

1 Answers1

1

Since I don't have enough reputation to comment yet, I will need to get clarification from you through the answer. Are you attempting to run a macro with the button click?

If so, the direction should be accessing the data itself or the macro itself.

For accessing Excel Data, you can refer to:

Read Data from Excel using C#

For accessing Excel Macro, you can refer to:

Running Excel Macro using C#

Jacky Tan
  • 31
  • 1
  • 3
  • I don't have the password macro for the Excel file, so I have to enter it manually – mahdi0000 Apr 13 '20 at 18:53
  • You can specify the password parameter in Workbooks.Open. The documentation can be refer here: https://learn.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel.workbooks.open?view=excel-pia – Jacky Tan Apr 14 '20 at 03:25