0

I am writing an excel Add which will fetch data from database. I am able to add the custom menu to excel in OnConnection Extensibility.IDTExtensibility2, but after that the Excel Object is destroyed and I am not able to access the Active Workbook.

How to access the excel workbook that is active?

Eranga
  • 32,181
  • 5
  • 97
  • 96
user1131450
  • 21
  • 1
  • 4

1 Answers1

3

1>((Microsoft.Office.Interop.Excel.Application)Marshal.GetActiveObject("Excel.Application").ActiveWorkBook
2>You can check my answer here to get handle to excel application object Get the excel cell address from a UDF

Community
  • 1
  • 1
Brijesh Mishra
  • 2,738
  • 1
  • 21
  • 36