YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Change trend titles in excel Options · View
Chris101
#1 Posted : Monday, November 29, 2010 9:30:22 PM
Rank: Newbie
Groups: Member

Joined: 11/29/2010
Posts: 9
Location: DK
Hi All.

I have a spreadsheet, with about 15 to 20 trends on it. Is it possible, to change all the different trend titles, with some VBA code, when I press a button ?.

I need to do this because, I need the spreadsheet to be bilingual.

Hope someone can help me out here.

We use PI link V.4.1.1 and Excel 2007

Best regards from.

Chris
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
RJK Solutions
#2 Posted : Monday, November 29, 2010 10:44:11 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 617
Location: Cheshire, United Kingdom.
Hi Chris,

Welcome to the forum.
Here is some sample code I put together, it is within the context of an Excel worksheet but no reason you can't roll it up to a workbook level.

Code:

Sub ChangeTitles()

Dim i As Integer
For i = 1 To Me.OLEObjects.Count
    If Me.OLEObjects(i).progID = "PITrend.PITrend.1" Then
        Dim TC As TrendConfig
        Set TC = Me.OLEObjects(i).Object.GetConfiguration
            TC.Title.Text = "RJK Solutions is cool."
            Me.OLEObjects(i).Object.SetConfiguration TC
        Set TC = Nothing
    End If
Next i

End Sub


Enjoy!
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Chris101
#3 Posted : Tuesday, November 30, 2010 8:26:17 PM
Rank: Newbie
Groups: Member

Joined: 11/29/2010
Posts: 9
Location: DK
Hi.

THANKS for the sample code, it was just the kick starter i needed Smile

I have made a Select case in the code, and use that to "grap" the trends I want to change the title on, is that a bad way of doing it ?

Best regards from.

Chris
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.