Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default VSTO - How to find all Pivot tables in the Workbook

Hi ,
I have seen a lot of examples how to find pivot tables using macro.
But in C# I don't have Count property

for (int i = 1; i <= this.Application.Sheets.Count; i++)
{
Excel.Worksheet ws =
(Excel.Worksheet)this.Application.Sheets[i];
for (int j = 1; j<= ws.PivotTables.Count // ERROR

How can I do it in C#?
Thanks a lot
Smugliy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default VSTO - How to find all Pivot tables in the Workbook

Does this part work?

this.Application.Sheets.Count

I would have done something like
this.Application.ActiveWorkbook.WorkSheets.Count, but I can't pretend to
know how VSTO works. It's a matter of referencing more specifically. If you
ask how many pivot tables are on a chart sheet, you'll get an error.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Smugliy" wrote in message
...[i]
Hi ,
I have seen a lot of examples how to find pivot tables using macro.
But in C# I don't have Count property

for (int i = 1; i <= this.Application.Sheets.Count; i++)
{
Excel.Worksheet ws =
(Excel.Worksheet)this.Application.Sheets;
for (int j = 1; j<= ws.PivotTables.Count // ERROR

How can I do it in C#?
Thanks a lot
Smugliy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default VSTO - How to find all Pivot tables in the Workbook

I found it if somebody interested


Excel.PivotTables pivotTables1 =
(Excel.PivotTables)ws.PivotTables(Type.Missing);

if (pivotTables1.Count 0)
{
for (int j = 1; j <= pivotTables1.Count; j++)
}

"Smugliy" wrote:
[i]
Hi ,
I have seen a lot of examples how to find pivot tables using macro.
But in C# I don't have Count property

for (int i = 1; i <= this.Application.Sheets.Count; i++)
{
Excel.Worksheet ws =
(Excel.Worksheet)this.Application.Sheets;
for (int j = 1; j<= ws.PivotTables.Count // ERROR

How can I do it in C#?
Thanks a lot
Smugliy

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
pivot tables across sheets in a workbook NICK Excel Discussion (Misc queries) 2 June 10th 09 02:01 PM
Find Pivot Tables in workbook based on their name goofy11 Excel Discussion (Misc queries) 0 March 25th 09 07:54 PM
Referring to all pivot tables in a workbook klysell Excel Programming 3 August 1st 07 09:52 PM
Refreshing all pivot tables in workbook klysell Excel Programming 5 August 1st 07 06:16 PM
Pivot Tables and Cells.Find [email protected] Excel Programming 3 August 12th 05 10:43 PM


All times are GMT +1. The time now is 03:00 AM.

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"