View Full Version : create and hide an excel sheet from ppt

11-07-2007, 03:38 AM

I want to build some code, integration Powerpoint and Excel. One thing I want to do is to create a new sheet in (the active workbook in) Excel, and hide it (and leave the originally active sheet active). I've written the code below.

I would expect a new sheet to be created and inserted at the end of the existing sheets, and being hidden. However, the sheet is created, but it's not hidden, and it's not at the end of the sheets (but at the position of the activesheet). Furthermore, the current_sheet is not activated/selected. Anyone any idea what's going wrong?

To be complete: i'm using old-fashioned Office 2000. Nothing to do about that...



sub create_excel_sheet()
dim ExcelObject as Excel.Application
Dim settings_sheet As Excel.Worksheet
dim current_sheet as Excel.Worksheet

Set ExcelObject = GetObject(, XLAPPCLASS) 'Gets the active excel
Set current_sheet = ExcelObject.ActiveSheet
Set settings_sheet = ExcelObject.Sheets.Add _


end sub