Home |
Search |
Today's Posts |
|
#1
![]()
Posted to comp.lang.basic.visual.misc,microsoft.public.excel.programming
|
|||
|
|||
![]()
That would be one of the primary reasons.
-- Regards, Tom Ogilvy "Todd Beaulieu" wrote in message ... Excellent. Thanks! I used to work so much with Excel/VBA and I know it's ultra-capable. I'd like to get more into it again. Do you use late binding to allow for the different versions? I hate having to do that. "Tom Ogilvy" wrote in message ... From help on the workbooks.Add method: If this argument is a constant, the new workbook contains a single sheet of the specified type. Can be one of the following XlWBATemplate constants: xlWBATChart, xlWBATExcel4IntlMacroSheet, xlWBATExcel4MacroSheet, or xlWBATWorksheet. then from the immediate window: ? xlWBATWorksheet -4167 Use the value of the constant since if you use late binding, the constant won't be defined. -- Regards, Tom Ogilvy "Todd Beaulieu" wrote in message ... How the heck did you figure that one out? Where's that magic number come from? I chose a different route. Probably less elegant, but it doesn't touch settings. After starting a new workbook, I simply delete all worksheets after the first one. "Jim Rech" wrote in message ... I'm game. See below. -- Jim Rech Excel MVP The default is not visible I believe xlApp.Visible = False Doing this changes the user's default, so if you want to go this route, get and restore the user's setting. xlApp.SheetsInNewWorkbook = 1 Another way is: xlApp.Workbooks.Add -4167, which adds a one sheet workbook and you do not have to touch SheetsInNewWorkbook. Then your code would add 2 sheets instead of 3: xlWB.Worksheets.Add , , 2 and rename them in the loop. Set xlWB = xlApp.Workbooks.Add For i = 1 To 3 Set xlWS = xlWB.Worksheets.Add(After:=xlWB.Worksheets(i)) xlWS.Name = Str$(i) Next i There is no reason to capture/restore this since it does not become the user's setting and in fact is always turned off automatically when code execution ends. bAlerts = xlApp.DisplayAlerts xlApp.DisplayAlerts = False xlWB.Worksheets("Sheet1").Delete xlWB.Worksheets(1).Activate |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
What does Show Ink in Excel, Review Tab, comment, do? | Excel Worksheet Functions | |||
review changes in workbook | Excel Discussion (Misc queries) | |||
i have a fax sent to me for review but i cant open its saying i n | New Users to Excel | |||
excel review bar | Excel Discussion (Misc queries) | |||
Is there a quick way to see which objects have code attached? | Excel Programming |