Is there an easy to find the offending variable producing a "type mismatch" error when a script is run?
There's not a "way" to do this, but there is a way of looking at things that could make it easier. What I would do is to make a variable for EVERY piece of data in your script where you think the problem might be and use the debugger to see the data types associated with the error. For example, instead of:
Call uidoc.FieldSetText( "fname", otherDoc.otherField(0) )
VarTemp = otherDoc.otherField(0) Call uidoc.FieldSetText( "fname", VarTemp )
When you do that, you could step through the debugger and view the variables to see what DataType is assigned to VarTemp. Then you know if it is not text that is where your error is. If the error is on assignment to a variable and you have "option declare" or "option explicit" in place, then use a temporary variant variable to determine the data type that you were trying to stuff into the variable.
I hope this helps you.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.