Michael, Here is the code: object missing = Type.Missing; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); Workbook xlWbk = null; try { xlWbk = xlApp.Workbooks.Open(schemaPath, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing); xlApp.Run("CreateScripts", true, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing); object ret = (object)""; ret = xlApp.Run("GetLog", missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing); xlApp.DisplayAlerts = false; xlWbk.Close(false, missing, missing); } catch (System.Exception ex) { MessageBox.Show("An error occurred updating the config file:" + ex.Message); return false; } finally { xlApp.Quit(); xlWbk = null; xlApp = null; }
What the code is basically doing is:- opening a spreadsheet.- executing one of the VBA macros stored within- calling another VBA function to return the log information created from the previous call- closing/exiting.Cheers,Tim