Getting a strange error with a visual basic script, only on a certain file though?

This is a script that among other things, creates a string of text from user input adding the words Cyan Magenta Yellow Black at the end. This is for marking plates with the respective colors. This script as far as I can tell, works fine in every file I've tried it on, except one which gives the above cryptic error. Hitting End in the dialog ends the script execution but Draw is then in a state that it can't be used and has to be closed. Doesn't crash, just doesn't update the screen.

Here's the relevant code that is causing the problem, it counts the words in the line of text and selects the relevant color name and applies the correct color to it:

Dim tr1 As TextRange, tr2 As TextRange, tr3 As TextRange, tr4 As TextRange
Dim wordcount As Long

wordcount = ActiveShape.Text.Story.Words.Count

Set tr1 = TxtInfo.Text.Story.Words(wordcount - 3)
Set tr2 = TxtInfo.Text.Story.Words(wordcount - 2)
Set tr3 = TxtInfo.Text.Story.Words(wordcount - 1)
Set tr4 = TxtInfo.Text.Story.Words(wordcount)

tr1.Fill.UniformColor.CMYKAssign 100, 0, 0, 0
tr2.Fill.UniformColor.CMYKAssign 0, 100, 0, 0
tr3.Fill.UniformColor.CMYKAssign 0, 0, 100, 0
tr4.Fill.UniformColor.CMYKAssign 0, 0, 0, 100

It gets hung on the first color assign for the Cyan word, "tr1.Fill.UniformColor.CMYKAssign 100, 0, 0, 0" if I comment that out, it gets hung on the next line for Magenta, and I presume from there on, I didn't test that far.

Again, this works fine in other files, just not this particular file for some reason. If I copy out the relevant objects to a new file, then it works fine, but in it's original file, it doesn't work. Kind of an odd thing and there is a work around but if I could find out what in this particular file is causing this issue, that would be nice to eliminate the problem.

Parents
No Data
Reply
  • OK there was an embedded font that was not installed (Adobe font) that seems to be the cause of the issue. Funny thing is, I had thought it might be font related and converted all fonts to outlines first and it still crashes when in that file. Because that file has an embedded, not installed font, it causes that error. After I installed the font in the Adobe font app, the script works fine. 

    Not sure what the deal is there, but seems to be the issue.

Children