Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have code in my workbook code that attempts to create a new sheet when the
workbook opens. I used: set oDoc = Workbooks.thisWorkbook oSht = oDoc.Add(after:=1) I get an error 1004. It doesn't add a sheet. Do I need to declare the workbook and sheet object? Bruce |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Dim oDoc As Workbook Dim oSht As Worksheet Set oDoc = Application.ThisWorkbook Set oSht = oDoc.Worksheets.Add(after:=oDoc.Worksheets(1)) -- Regards, Tom Ogilvy Bruce Lindsay wrote in message ... I have code in my workbook code that attempts to create a new sheet when the workbook opens. I used: set oDoc = Workbooks.thisWorkbook oSht = oDoc.Add(after:=1) I get an error 1004. It doesn't add a sheet. Do I need to declare the workbook and sheet object? Bruce |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to consolidate all worksheets data into 1 worksheets? | Excel Discussion (Misc queries) | |||
How use info in Excel shared worksheets to create new worksheets | Excel Worksheet Functions | |||
How do i assign the ActiveWorkbook.Worksheets to a worksheets object? | Excel Worksheet Functions | |||
Assigning Cells in worksheets to other data in other worksheets. | Excel Discussion (Misc queries) | |||
Need code to protect worksheets - amount of worksheets varies | Excel Programming |