How to open then close Excel RRS feed

  • Question

  • I need to open excel then create workbooks and then close excel

    I can create the workbooks if excel is already open but would like to have excel open without the user starting it.

    this is the VBA code I'm using
            xlapp = New Excel.Application
            'hrtemp = GetObject("Excel.Sheet")
            hrtemp = CreateObject("Excel.Sheet")
            hrtemp.SaveAs("C:\Documents and Settings\" & cuser & "\Application Data\log reporter\setup\hourly Energy Usage template.xls")
            dltemp = CreateObject("Excel.Sheet")
            dltemp.SaveAs("C:\Documents and Settings\" & cuser & "\Application Data\log reporter\setup\Dailly Energy Usage template.xls")
            wktemp = CreateObject("Excel.Sheet")
            wktemp.SaveAs("C:\Documents and Settings\" & cuser & "\Application Data\log reporter\setup\Weekly Energy Usage template.xls")
            mthtemp = CreateObject("Excel.Sheet")
            mthtemp.SaveAs("C:\Documents and Settings\" & cuser & "\Application Data\log reporter\setup\Monthly Energy Usage template.xls")
            hrtemp = Nothing
            dltemp = Nothing
            wktemp = Nothing
            mthtemp = Nothing
    Thanks Mike
    Wednesday, August 19, 2009 9:04 PM