I still havent got the first posts code but I am making progress on these parts but still having trouble converting.


VB Code:
  1. private object moApp;
  2. private System.Type moAppType;
  3.  
  4. /// Create the late bound app object
  5. moAppType = System.Type.GetTypeFromProgID("Excel.Application");
  6. object moApp = System.Activator.CreateInstance(moAppType);
  7.  
  8. /// ...
  9.  
  10. /// Closing of form but this line wont work for late binding
  11. if ((moApp.Workbooks.Count) > 0)
  12.  
  13. /// So I converted it to this but not working
  14. if (moAppType.InvokeMember("Workbooks.Count", System.Reflection.BindingFlags.GetProperty, null, moApp, null) > 0)
  15. [Error: Operator '>' cannot be applied to operands of type 'object' and 'int']