Type Mismatch when forcing Named Data Source reference with ReferenceSharedSubString Follow


We use Automation scripts to drive label generation. I am trying to set a font color using VBScript in a template based on a value provided in the data from our backend. The color is provided in the named data source "piece_meta_label_font_color." I am trying to change the color of the Text Objects "Metric Size" and "Standard Size." The data provided by the database and therefore contained by the Named Data Source is BtColor.Black. Based on the articles I have read, (Page 10 Here) and Here here is the script I have written.

Objects("Standard Size").TextColor = Eval(Format.NamedSubStrings("piece_meta_label_font_color").Value)
Objects("Metric Size").TextColor = Eval(Format.NamedSubStrings("piece_meta_label_font_color").Value)

The error I receive is: OnOpen (Line 1): Type mismatch: 'ReferenceSharedSubString'

Any help would be apprecaited.



Xabier Clemente
Comment actions Permalink

Hi Stephen!

Thank you for posting on our Community Forum!

Could it be that you've "named" the database field which contains the color and that you are using it to dynamically change the color of the specified objects? If so, this step is unnecessary and may lead to unwanted behavior, such as error messages.

We would advise instead forcing the reference to a database field directly, without using any named data sources:

The documentation you previously referenced also makes mention of doing this.

I hope this helps!

Please sign in to leave a comment.