dslreports logo
 
    All Forums Hot Topics Gallery
spc
Search similar:


uniqs
683

Robert
Premium Member
join:2001-08-25
Miami, FL

1 edit

Robert

Premium Member

[Excel] Style Group Outline with VBA?

I'm working on a project where the system generates an excel based report. It groups and creates an outline for specific data. I can have the system, before it spits out the excel sheet, to run any macro embedded in the excel sheet.

I googled around but wasn't able to figure out if there is an ability to set the style of grouped rows/columns with a VBA?

In my mind, I'd think it would be something like:

ActiveSheet.Outline.Style RowLevels=1 Style=Style Name
ActiveSheet.Outline.Style RowLevels=2 Style=Style Name1

Does this make sense?

Thanks,

Robert
Robert

1 edit

Robert

Premium Member

Just wanted to update that I was able to accomplish (some)what I was trying to do.

I created styles called "RowLevel_x" (where "x" is the outline level) and then enabled automatic styles in Excel.

Once the system generates the excel sheet and creates the outline, Excel automatically applies the style based on the style I created. For some reason level3 doesn't work, but at least I have level 1 and level 2 working.

2kmaro
Think

join:2000-07-11
Oklahoma City, OK

2kmaro

Rob,
It might be that the syntax of the command changes at level 3? One way I go about seeing proper syntax for commands I'm either unfamiliar with or have just forgotten about is to simply record a macro while doing all of the operations I need to code up later. Then I examine the code generated.
For the level 3 part - is it just "not doing anything" or is it generating an error. Sometimes an error is much more informative than "just doesn't do anything".

Robert
Premium Member
join:2001-08-25
Miami, FL

Robert

Premium Member

said by 2kmaro:

Rob,
It might be that the syntax of the command changes at level 3? One way I go about seeing proper syntax for commands I'm either unfamiliar with or have just forgotten about is to simply record a macro while doing all of the operations I need to code up later. Then I examine the code generated.
For the level 3 part - is it just "not doing anything" or is it generating an error. Sometimes an error is much more informative than "just doesn't do anything".

Thanks for the reply. After the Excel worksheet is generated, since I have automatic styles enabled in Excel, Excel itself generates RowLevel_3, overriding my RowLevel_3. Their RowLevel_3 style has no formatting what-so-ever.

I'm thinking that RowLevel_3 cannot be changed, but instead is a simple style created by Excel just to differentiate from RowLevel_1 & RowLevel_2.