0
Reply

Dynamically loading an assembly

sharmilee kumari

sharmilee kumari

Sep 27 2012 12:38 AM
975
I need to dynamically load an assembly. Currently I am working with "Microsoft.Office.Microsoft.Office.Interop.dll". I need to open an excel file and get the sheets and data out of it. Can anyone tell me how can I do it?

 Assembly SampleAssembly = Assembly.Load
             
("Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");

           
if (SampleAssembly != null)
           
{
               
Type type = SampleAssembly.GetType("Microsoft.Office.Interop.Excel.ApplicationClass");
               
Object AppClass = Activator.CreateInstance(type);

               
//How will I get ApplicationClass object and Workbooks objects here?
           
}