Show detail of outline using VBA code

  • Thread starter Thread starter Dan Polansky
  • Start date Start date
D

Dan Polansky

When using outline, how do I show detail and hide detail
using VBA code?

Thank you.
 
Record a macro.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks, Dave. Showlevels is useful. However, I wanted to unfold only
single fold, not all the folds on a given level. Do you have an idea
how to do that?
 
Bob, that's what I've tried. At the first attempt, nothing of relevance
has been recorded. At the second attempt, the following cryptical
command has been recorded.

ExecuteExcel4Macro "SHOW.DETAIL(1,184,TRUE,,188)"

When I tried to run the recorded macro, it did not work anyway; it gave
an error. I am using Microsoft Excel 2000. I don't have a clue as to
what Excel4 is referring to. My guess is that, in the recorded command,
1 refers to a column and 184 and 188 give a range of rows.
Experimenting with the command did not produce any satisfactory result.
Any help is appreciated.
 
Maybe...

Option Explicit
Sub testme()

Dim myCell As Range
Set myCell = ActiveCell
With myCell.EntireRow
MsgBox .OutlineLevel
.OutlineLevel = .OutlineLevel + 1
MsgBox .OutlineLevel
End With
End Sub
 
Dan -

Here's a short version of what my ancient documentation for Excel 4 macro
programming language (XLM) says:

SHOW.DETAIL(rowcol,rowcol_num,expand)
Expands or collapses the detail under the specified expand or collapse
button.
Rowcol = 1: Operate on rows
Rowcol = 2: Operate on columns
Rowcol_num: The row or column to expand or collapse
Expand: Logical value specifying whether to expand or collapse

Only three arguments are documented in my reference. Your example shows five
arguments.

- Mike
www.mikemiddleton.com
 
Dave, that's an interesting script, but does not do what I want. I do
not want to change the outline level of a cell; I want to unfold the
cell. When I unfold the cell, its outline level stays the same; just
the cell's subordinated cells should be made visible.

Thanks anyway, Dan
 
Mike, that was helpful. Now I've got the working macro

Sub Unfold()
ExecuteExcel4Macro "SHOW.DETAIL(1," & ActiveCell.Row & ",TRUE)"
End Sub

Still don't know how to fold; using HIDE.DETAIL instead of SHOW.DETAIL
does not do.
Thanks, Dan
 
Mike, that was helpful. Now I've got the working macro

Sub Unfold()
ExecuteExcel4Macro "SHOW.DETAIL(1," & ActiveCell.Row & ",TRUE)"
End Sub

Still don't know how to fold; using HIDE.DETAIL instead of SHOW.DETAIL
does not do.
Thanks, Dan
 
Here's the solution:

Sub Fold()
ExecuteExcel4Macro "SHOW.DETAIL(1," & ActiveCell.Row & ",FALSE)"
End Sub

It follows directly from the help sent by Michael R Middleton.
--Dan
 
Back
Top