Click to See Complete Forum and Search --> : Excel Object Library


Kathy
September 29th, 1999, 08:36 AM
Hi

I want to append 1 more Sheet to my Workbook.
And I have trouble using :

dim MyWorkbook as Workbook
MyWorkbook.Worksheets.Add ([Before],[After],[Count],[Type]) as Object

What am I supposed to pass to [Before] or [After] ?

Thanks

Lothar Haensler
September 29th, 1999, 09:16 AM
these are all optional parameters. So, you can just omit them:
Set ws = ...WorkSheets.Add

Kathy
September 29th, 1999, 09:22 AM
Thanks for the reply.

The thing is I want to add my sheet to the end of the existing Sheets.
If I omit those optional parameters, my sheet will added infront of the
existing ones. I'm sure there 's something to do with with those [Before],[After] parameters.

Lothar Haensler
September 29th, 1999, 09:28 AM
OK, here is a sample from the online docs:
Worksheets("Sheet1").Move After:=Worksheets(Worksheets.Count)

Kathy
September 29th, 1999, 09:51 AM
Thanks, it works !

Kathy
September 29th, 1999, 11:08 AM
Lothar,
Can you tell me where that online docs are, I still have a
small problem with that Sheet insertion.

The first insertion and move is OK.
But right second insertion, seems like the move is executed automatically
with the old "Worksheets.count"


Thanks