Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Set Group and Outline settings...

I've tried two different ways of having the Group and Outline settings
defaulted to the way I want them whenever I open a workbook (I want the
little plus signs to be above and to the left).

Can't get either of them to work.

Attempt #1 - modify the settings thru the command bar:

Sub GroupAndOutline1()
Dim SettingsPopup As CommandBarButton
Set SettingsPopup =
Application.CommandBars(1).Controls(7).Controls(9) .Controls(7)
<got stuck here
End Sub

This got me almost there. I could do SettingsPopup.execute, and the
window would pop up, but I couldn't figure out how to
programatically set the booleans.

Attempt #2 - modify settings via the Outline object

Public Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In Application.Worksheets
Debug.Print ws.Name
ws.Outline.SummaryRow = xlAbove
ws.Outline.SummaryColumn = xlLeft
Next ws
End Sub

This seems to work on its own (i.e. the same code in a macro), but when
I use it like so in workbook_open, I get the following error when I
open Excel:

Run-time error "1004".
Method "Worksheets" of object '_Application' failed.

Which seems to me that it's saying that it thinks Worksheets is being
used as a method (although why it's ok when I just call it on its own
is confusing).

Any help with this would be appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Set Group and Outline settings...

Your code worked for me as is in my test workbook.

Is there any chance that one of the worksheets is protected--or the workbook
itself is shared?

wrote:

I've tried two different ways of having the Group and Outline settings
defaulted to the way I want them whenever I open a workbook (I want the
little plus signs to be above and to the left).

Can't get either of them to work.

Attempt #1 - modify the settings thru the command bar:

Sub GroupAndOutline1()
Dim SettingsPopup As CommandBarButton
Set SettingsPopup =
Application.CommandBars(1).Controls(7).Controls(9) .Controls(7)
<got stuck here
End Sub

This got me almost there. I could do SettingsPopup.execute, and the
window would pop up, but I couldn't figure out how to
programatically set the booleans.

Attempt #2 - modify settings via the Outline object

Public Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In Application.Worksheets
Debug.Print ws.Name
ws.Outline.SummaryRow = xlAbove
ws.Outline.SummaryColumn = xlLeft
Next ws
End Sub

This seems to work on its own (i.e. the same code in a macro), but when
I use it like so in workbook_open, I get the following error when I
open Excel:

Run-time error "1004".
Method "Worksheets" of object '_Application' failed.

Which seems to me that it's saying that it thinks Worksheets is being
used as a method (although why it's ok when I just call it on its own
is confusing).

Any help with this would be appreciated.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Set Group and Outline settings...

Thanks.

It's possible that's the cause, but I'm not knowingly using protection
(ahem) or sharing.

Some more data points...

- if I just launch Excel, it works fine (in Book1, no error & settings
are as I expect)
- if I close Excel & then open a workbook, I get the error as above

Another thing, I noticed that I was mistaken about how Workbook_Open in
personal.xls works... I thought this was invoked whenever any workbook
was opened, but now I think it's only invoked when Excel is first
opened (I used a msgbox to confirm this). So, I think I need to have
my code somewhere else so that it's invoked whenever I open a new
workbook. Not sure where that is.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Under data/Group&outline/group Bernard Excel Discussion (Misc queries) 1 July 2nd 09 01:02 AM
"Data Group and Outline Group" feature Limited to 8 levels MarekMG Excel Discussion (Misc queries) 3 May 25th 07 06:12 PM
Group and Outline Marsh New Users to Excel 2 January 27th 07 05:19 PM
Group and Outline Cara Excel Discussion (Misc queries) 1 October 10th 06 01:53 AM
Group and Outline Settings -Problem Courtney Excel Discussion (Misc queries) 0 April 10th 06 10:00 PM


All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"