Object error when dynamically changing font color in script. Follow

-1
Avatar
Todd Hansen

I am having problems with a VB script that I am using to change the color the text for an items on my label.  I have the below script entered in the VB Scripting section of Transformations.  When I test the Script I get an error “<Line 7: : Type mismatch: 'Objects'>.

Could use some pointers on what I am doing wrong.

Thanks

ReferenceField ("WP066009.PFPTXT")

Set Pallet = Objects("Text 10")

 

If (Field("WP066009.PFPTXT") = "PARTIAL PALLET") Then

   Pallet.TextColor = btColor.Black

   Pallet.TextBackgroundColor = btColor.White

Else

   Pallet.TextColor = btColor.White

   Pallet.TextBackgroundColor = btColor.Black

End If  

 

 

2 comments

0
Avatar
KM3
Comment actions Permalink

I don't think using a class object like this works... Idk, could be wrong. But I'm pretty sure you can't manipulate objects (layout elements) in the OnProcessData event. Go to File > Document Options > VBScript (off the top of my head). Enter the script there. To reference your "Text 10" element, simply write Format.Objects("Text 10").TextColor  = btColor.White. Or similar. Shouldn't be too hard to figure out.

0
Avatar
Todd Hansen
Comment actions Permalink

That got it working.

Thanks

 

Please sign in to leave a comment.