cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Error: GetValue. Value not found

JBlackhole
16-Pearl

Error: GetValue. Value not found

I have got a (very) long VB script in a button to import data in a template. The script works fine but every so often when opening the mcad and while initialising the scrip an error message is displayed, see attached, about a value not being found. The value not found is called using the following statement

ValueFound =UCase(WorkSheet.GetValue("TypeofData"))

Where the variable �TypeofData� is defined in the mcad document and is a string and definitely exists.

I could hardcode the variable �ValueFound� but I use the script in 4 different mcad documents and the only thing I need to do is copy and paste it in each document. Since the variable �TypeofData� is defined (and specific) to each mcad doc. I do not have to worry about updating hardcoded variable. By using the GetValue keyword the right part of the script is used.

Does anyone have any suggestions about this problem?

Thanks

Regards

JXB
2 REPLIES 2

Hard to say without the actual file, but it may be a matter of timing. The variable will not be defined until its defining expression is evaluated. If the script runs before that happens the variable will not be found.

Also note that Mathcad does not necessarily evaluate all regions in the sheet. Regions whose values are not needed for a visible result may not be calculated.
__________________
� � � � Tom Gutman
RichardJ
19-Tanzanite
(To:JBlackhole)

Mathcad does not calculate regions until either you scroll the worksheet until they are visible, or you hit Ctrl F9. The only thing you can really do about it is to trap the error and handle it more gracefully. If you click on the button in the attached worksheet when it's first opened it tells you the string has not been calculated. If you either scroll down to see the assignment or hit Ctrl F9, then click on the button, it gets the value.

Richard
Announcements

Top Tags