Colour Code Follow

0
Avatar
Legacy Poster

Hi, 

 

I did spend last couple days trying find out the possibility to colour code the box shape based on data in excel. 

 

Is there any possibility to colour code shape based on number or words, if not what else i can use to make it happen? 

 

Thanks,

Josh 

3 comments

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

You can do this inside the BarTender document by making use of some document level based VBScript (only available in Automation Editions of BarTender). This VBScript can be found under BarTender's "File > BarTender Document Options" dialog and now accessing the "VBScripting" tab.

 

You can find a full reference on this under BarTender's Help (F1 key) and now by visiting the "Visual Basic Scripting > Scripting Objects > Object Reference > Object object" topic. FillColor and LineColor property are the ones you need to look at.

 

Furthermore, some more help can be found on the following White Paper:

http://www.seagullscientific.com/label-software/whitepapers/dynamically-changing-objects-at-print-time-using-vb-script.pdf

0
Avatar
Legacy Poster
Comment actions Permalink

Thank you very much for your help, i did managed get the new sample working but i'm struggling with my old label. 

 

ColourBox - object name 

Col alias to field in excel file called Colour 

In excel file colour is saved as hexadecimal format.  

 

I'm getting error message after i'm trying print label... 

Error Message #3904 

 

OneNewRecord Type mismatch: 'Clng' 

 

When i change "Field("Col")" to "&HFFFF0000" everything is working fine. (all the fields in excel for colour are with "&HFFFF0000") 

 

Currently VBA code is setup as bellow: 

 

ReferenceField("MDA$.Col")
Format.Objects("ColourBox").FillColor = Clng(Field("Col"))

 

Thank you. 
 
Josh, 
 
-1
Avatar
Fernando Ramos Miracle
Moderator
Comment actions Permalink

Could you clarify exactly when are you getting this error message?

 

If it's when entering the code this is expected, note that at design time the database field reference will have a default value which probably has nothing to do with the actual contents of the database.

 

If you ignore the error and test printing, do you still get this error message?

 

*If you wish to prevent this design time error you can always specify the default value for the field reference, for example: Field("Col","&HFFFF0000")

 

Regards

Please sign in to leave a comment.