index > Visual Studio Tools for Office > Getting Number of Charts and Setting Titles

Getting Number of Charts and Setting Titles

In VS2005 B2, how can I get the amount of charts on a sheet and set the title for each in a loop?



T-Bone
tbonejo
There is a Charts collection which exists.

To get the number of chart on a sheet, try to get this charts collection and use the Count property of this collections


HTH.

Bye


Blog on WPF / C# / .NET: http://blogs.developpeur.org/tom | Site: http://morpheus.developpez.com
LEBRUN Thomas
If you add the following code to your ThisWorkbook_Startup event you'll see it lists the number of sheets and then their names:

            MessageBox.Show(this.Sheets.Count.ToString());
            foreach (Excel.Worksheet s in this.Sheets)
            {
                MessageBox.Show(s.Name);
            }

Ade



Development Lead, Microsoft VSTO
Ade Miller - MSFT
Yes, but if I'm rigth, he wants to display the number of charts on a sheet, not the number of sheets.

So maybe he could try something like this:



MessageBox.Show(this.Sheets.Charts.Count.ToString());

 


(Notice that I haven't test this code)

HTH.

Bye.


Blog on WPF / C# / .NET: http://blogs.developpeur.org/tom | Site: http://morpheus.developpez.com
LEBRUN Thomas
I did figure it out, however, I am assuming with VS2005 B2, ONLY Office 2003 is supported thru the .net and anything below that is a com ref? Or else Im not doing the setup correctly.



T-Bone
tbonejo
With Office 2003, Excel, Word and Outlook are supported in .NET
InfoPath, PowerPoint and Access are COM automation




Blog on WPF / C# / .NET: http://blogs.developpeur.org/tom | Site: http://morpheus.developpez.com
LEBRUN Thomas
reply 6

You can use google to search for other answers

 

More Articles

• How To add both SelectionChange and ItemSend delegates?
• VSTO Outlook 2007 Form Region Question
• Word - Cursor Position
• Range & Selection
• Build an Action Pane Across All Document Types?
• VB.NET: Problem with Page header in Word Document
• How to populate Word 2003 ComboBox / Dropdown list using VSTO C#
• Outlook AddIn Install On User Machine Failure
• Transfer windows form contents to a word File
• ServiceRequest Failed
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Copy Excel Sheet from one Workbook to Ot
• Excel 2003 XML Maps
• get an idispatch of active document
• Error when Implement the DragDrop
• VS 2005 Editions
• Deploying an XML Schema Definition with
• Dynamic XMLNode controls
• How to get char(13)&char(10) in Exce
• Access 2003 Developer Extensions with VSTO
• VSTO Word Template & Custom Menus/To
• Can a program created for outlook 2003 r
• Problems installing Visual Studio 2005 T
• Save large dataset to database
• How to Archive or customize Archive setu
• Deleting Excel Sheet, and setting the ca

Hot Articles

• How to rectreive a display name from the
• Upgrading excel workbook solution from V
• XSD File is not showing all the data fie
• VSTO crash :)
• VSTO 2005 beta2 with .NET 2003??
• Calendar Date Range
• Outlook : GAL
• Submenus with VSTO 2005?
• ServerDocument VSTO2 question
• VSTO Document From Windows Application
• I have a checkbox in my excel spreadshee
• InfoPath XSL Bug
• Hide Table & Word 2003...
• Creating tab delimited text files form e
• Access parent doc in VSTO

Recommend Articles

• Excel ListObject Blue Border
• Can you get an excel range object from t
• MS Access opening exclusivly
• How to control the cell's datatype of Ex
• How to do ignore spelling error using VSTO
• Ability to lock worksheet
• Integrated Windows authentication and MS
• CustomUI / Ribbon Schema
• I have a checkbox in my excel spreadshee
• Delete a file rename another??
• Saving workbook from template without co
• Warning for using Excel.Worksheet.Activa
• Removing and Adding controls in the same
• accessing "new mail" objects o
• Visual Studio 2005 Word and Outlook 2003