Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I'm trying to create new Worksheets in my code but I really have
no clue how to... here is part of my code. the code I'm is really the one from this webpage: http://support.microsoft.com/kb/178781 but the problem is that they say nothing about creating a new Worksheet. Thanks for your help in advance. //Header declarations.. _Application xlApp; Workbooks wb; _Workbook _wb; Worksheets ws; //Source //Add Workbook wb = xlApp.GetWorkbooks(); _wb = wb.Add(covOptional); ws = _wb.GetSheets(); //Remove the 3 default sheets _Worksheet selSheet; selSheet = ws.GetItem(COleVariant((short)1)); selSheet.Delete(); selSheet = ws.GetItem(COleVariant((short)2)); selSheet.Delete(); selSheet = ws.GetItem(COleVariant((short)3)); selSheet.Delete(); If you want to rename any of these sheets is really easy// selSheet = ws.GetItem(COleVariant((short)2)); selSheet.SetName("NonInteractive Mode Results"); -Jona |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jul 6, 11:40 am, Jona wrote:
Hi, I'm trying to create new Worksheets in my code but I really have no clue how to... [snip] For the greater majority of Excel actions, you can find out how to do them in VB through the Macro Recorder. Turn it on, do the action manually, turn it off, then look at the code that Excel created. If you need options, you can usually look them up pretty easily in the Helps, once you have the hint that the Macro Recorder gives you. So start with Tools Macro Record New Macro... Socks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, for the tip. I've tried that and it did give me a hint but
I'm still stuck with the add() function. I really don't know what to put into this function... any ideas? thanks! this are the parameter that the add() function takes: ws.Add( const VARIANT &Before, const VARIANT &After, const VARIANT &Count, const VARIANT &Type ); |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is from Excel VBA help:
Before Optional Variant. An object that specifies the sheet before which the new sheet is added. After Optional Variant. An object that specifies the sheet after which the new sheet is added. Count Optional Variant. The number of sheets to be added. Teh default value is one. Type Optoinal Variant. Specifies sheet type. Can be on of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. If you are inserting a sheet based on an existing template, specify the path to the template. The default value is xlWorksheet. "Jona" wrote in message ups.com... Thanks, for the tip. I've tried that and it did give me a hint but I'm still stuck with the add() function. I really don't know what to put into this function... any ideas? thanks! this are the parameter that the add() function takes: ws.Add( const VARIANT &Before, const VARIANT &After, const VARIANT &Count, const VARIANT &Type ); |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
compare excel worksheet and output difference to new worksheet | Excel Discussion (Misc queries) | |||
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 | Excel Worksheet Functions | |||
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet | Excel Worksheet Functions | |||
excel 97: copy and paste values from one worksheet to another worksheet | Excel Programming | |||
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet | Excel Programming |