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

Button to change trend colours Options · View
rygon
#1 Posted : Thursday, December 15, 2011 12:10:23 AM
Rank: Newbie
Groups: Member

Joined: 12/14/2011
Posts: 2
Location: UK
Hi, pretty new to vba and im getting stuck on this problem.
We have a lot of trends that have different background colours, line colours etc and I want to change them to a standard set of colours. I was thinkig if I make a button and then open each trend individually I would be able to do this.

I was thinking of changing this to suit my needs (found on OSI KB Articles) but it doesnt like the "tcolor = TrendBackgroundColor()
Quote:

Public Sub Prevtrend()
Dim tcolor As Long
tcolor = Trend.BackgroundColor()
Trend.BackgroundColor = RGB(128, 128, 128)
ThisDisplay.PrintPreview
Trend.BackgroundColor = tcolor
End Sub


I also found this code off this forum, but when I click my button, it opens the display the macros is run from and changes that instead of the display I had originally opened.
Quote:

Public Sub TrendColors()

Dim TheTrend As Trend
Set TheTrend = ThisDisplay.Symbols("Trend1")
Dim TF As TrendFormat
Set TF = TheTrend.GetFormat
TF.Elements(pbBackGround).Color = RGB(81, 81, 81)

Any help would be greatly appreciated (using 3.0.15.2 if that helps any)
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.
milesUK
#2 Posted : Thursday, December 15, 2011 8:49:46 AM
Rank: Advanced Member
Groups: Member

Joined: 5/28/2009
Posts: 75
Location: Cheshire, UK
rygon, have a look at this thread http://www.rjksolutionsl...-for-PIProcessBook.aspx

The basic framework was posted by the board organiser, Rhys.ThumbsUp In post #10 I put up modified code to do (i beleive) just what you ask.BigGrin

Miles
MilesUK
ProcessBook v3.0.15.3
rygon
#3 Posted : Friday, December 16, 2011 3:54:56 PM
Rank: Newbie
Groups: Member

Joined: 12/14/2011
Posts: 2
Location: UK
Great cheers, just what i wanted Smile I'll give it a go
milesUK
#4 Posted : Tuesday, December 20, 2011 8:27:02 AM
Rank: Advanced Member
Groups: Member

Joined: 5/28/2009
Posts: 75
Location: Cheshire, UK
rygon, glad we could help. thank you for feeding back - too many don't. Smile
MilesUK
ProcessBook v3.0.15.3
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.