Adding worksheet issue (1 Viewer)

KenHigg

Registered User
Local time
Today, 15:59
Joined
Jun 9, 2004
Messages
13,327
Hi All -

I am using Hyperion/Brio and JOOLE to manipulate an Excel spreadsheet. When I use the following code it errors saying there is a paren missing after the argument list:

oExcel.Sheets.Add(After:=2);

Any ideas? I've tried putting parens in different places with no luck, maybe another way to add a worksheet in a certain location (After:=2) - ??
 

Rx_

Nothing In Moderation
Local time
Today, 13:59
Joined
Oct 22, 2009
Messages
2,803
I am guessing the parameter must be fully qualified with the object.
Here is how to add to the last worksheet, you can always use 2 instead of the count.
new_sheet_name = "NoWayDude"
oExcel.Sheets.Add(After:=oExcel.Sheets(oExcel.Sheets.Count)).Name = new_sheet_name
oExcel.Sheets.Add(Before:=oExcel.Sheets(2)).Name = new_sheet_name

The following does work within a general module
Sub HeyJoe()
ActiveWorkbook.Sheets.Add(, ActiveWorkbook.Worksheets(ActiveWorkbook.Worksheets.Count)).Name = "joe"
End Sub
 

KenHigg

Registered User
Local time
Today, 15:59
Joined
Jun 9, 2004
Messages
13,327
Looks like I failed to reply that I had to doa work around for this - still could not get the '=' sign thing to work. Thanks for the suggestion Rx
 

Users who are viewing this thread

Top Bottom