Detecting Visible Columns and Rows

R

RobV

How do you programatically (with VBA) detect what columns and rows are
visible in an active view?
 
J

John

RobV said:
How do you programatically (with VBA) detect what columns and rows are
visible in an active view?

RobV,
That's coincidence, I just wrote a macro that needed this same
information. In pseudo code, this is what I did for the column
information:
1. Count the number of columns in the active view table. I used,
ActiveSelection.FieldIDList.count
2. Set up a loop based on step 1. To get the field names I used,
FieldConstantToFieldName(ActiveSelection.FieldIDList(1))

As far as knowing which rows are shown, for example when a filter is
applied, I use the following construct:
SelectTaskField
For Each t in ActiveSelection.Tasks
[do stuff]
Next t

Hope this helps.
John
Project MVP
 
R

RobV

Thanks, John. Great advice (as usual).

John said:
RobV said:
How do you programatically (with VBA) detect what columns and rows are
visible in an active view?

RobV,
That's coincidence, I just wrote a macro that needed this same
information. In pseudo code, this is what I did for the column
information:
1. Count the number of columns in the active view table. I used,
ActiveSelection.FieldIDList.count
2. Set up a loop based on step 1. To get the field names I used,
FieldConstantToFieldName(ActiveSelection.FieldIDList(1))

As far as knowing which rows are shown, for example when a filter is
applied, I use the following construct:
SelectTaskField
For Each t in ActiveSelection.Tasks
[do stuff]
Next t

Hope this helps.
John
Project MVP
 
J

John

RobV said:
Thanks, John. Great advice (as usual).

RobV,
You're welcome and thanks for the feedback.
John
John said:
RobV said:
How do you programatically (with VBA) detect what columns and rows are
visible in an active view?

RobV,
That's coincidence, I just wrote a macro that needed this same
information. In pseudo code, this is what I did for the column
information:
1. Count the number of columns in the active view table. I used,
ActiveSelection.FieldIDList.count
2. Set up a loop based on step 1. To get the field names I used,
FieldConstantToFieldName(ActiveSelection.FieldIDList(1))

As far as knowing which rows are shown, for example when a filter is
applied, I use the following construct:
SelectTaskField
For Each t in ActiveSelection.Tasks
[do stuff]
Next t

Hope this helps.
John
Project MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top