VBA Equivalent of the EvalText function

A

Aussie Susan

Visio 2003:

I am creating a 'search' function form in VBA and I want to allow the user
to enter a value in the same format as they would in a shapesheet cell: i.e.
"8 eh." would be 8 elapsed hours. This is similar to when I enter a value in
(say) the 'Custom Properties' form.

However, when I perform the comparison with the cell value for a shape, (for
various reasons) I'm using the 'Results(visNone)' function to retrieve the
cells value which always returns the cell value in its 'native' form: i.e. "8
eh." comes back as 0.333333...

I am currently using an otherwise unused page shapesheet cell to store the
user entered string and then retrieve the value so that I can make a proper
comparison (if the user enters "8 eh." and is looking for shapes with a value
greater than this, then having the cell return 12 elapsed hours as 0.5 then
the comparison will be wrong!)

Is there a VBA function that I can call which will interpret a string value
in the same way that the shapesheet cells would interpret the string?
Something like the 'EvalText' shapesheet function would be exactly what I'm
after.

Thanks

Susan
 
J

JuneTheSecond

Hi Susan,

You might use Cell.Result property with Arg visElapsedHour.
For Example:
Debug.Print shp.Cells("User.Row_1").Result(visElapsedHour)
 
A

Aussie Susan

Thanks for the suggestion June but this is a general purpose search form that
I need to build and I don't necessarily know beforehand the value the user
may choose to use for the search. It may or may not be an elapsed time field
- it could just as easily be a counter field or one containing an index value
or one with a completely different unit of measure. The user knows the type
of field they are searching on and will enter an appropriate dimensioned
value when appropriate.

This is why I'm trying to find a way of interpreting the users input rather
than extracting the shapesheet value with an appropriate result unit of
measurement.

Susan
 
J

JuneTheSecond \)cotton.ocn.ne.jp>

Susan,

I think you already know that the units of 0.3333
are elapesed days.
As the length units of inner process in Visio are
inches, it seems the time unnits are days.
I don't know it is documented or not.
I thought there might be no way other than
to define the units or to use default units
in Visio VBA.

Visio seems not unitless system,
it is very complicated if you wish
to build a program for mathgematical
calculation such as product of
multiplied lengths.

--
Best Regards.

JuneTheSecond
Now the Visual calculation is more visual.
http://www.geocities.jp/visualcalculation/english/index.html
 
P

Paul Herber

Thanks for the suggestion June but this is a general purpose search form that
I need to build and I don't necessarily know beforehand the value the user
may choose to use for the search. It may or may not be an elapsed time field
- it could just as easily be a counter field or one containing an index value
or one with a completely different unit of measure. The user knows the type
of field they are searching on and will enter an appropriate dimensioned
value when appropriate.

This is why I'm trying to find a way of interpreting the users input rather
than extracting the shapesheet value with an appropriate result unit of
measurement.

Your search could have separate boxes for entry of the value and
another for the units, perhaps selectable from a drop down box.
 
A

Aussie Susan

Paul,

Just checking that I understand your suggestion: the user would see the
'human readable' units in the drop-down box and I could then convert that,
based on some lookup table, to the units I should use to retrieve the
shapesheet cell value.

If that's not it, then could you please explain further. If it is, then
thanks for the idea - I'll check it out with the business people and see if
it is acceptable.

Susan
 
P

Paul Herber

Paul,

Just checking that I understand your suggestion: the user would see the
'human readable' units in the drop-down box and I could then convert that,
based on some lookup table, to the units I should use to retrieve the
shapesheet cell value.

If that's not it, then could you please explain further. If it is, then
thanks for the idea - I'll check it out with the business people and see if
it is acceptable.

Yes, that's the idea.
Another thing to consider is whether allowing the user to enter the
units manually would create ambiguity.
Is m for miles or metres?
Is d for days or didots? (I had to look up that one !)
Is ' for feet or minutes of arc?
 
A

Aussie Susan

Thanks Paul.

Actually I have realised that there are only a few valid properties that the
user needs to search on, and they can be listed in a combo box.

Therefore, I try to convert the user entered number to a double and, if it
succeeds, I append the default unit string appropriate to the property on the
end, before storing it in a page shapesheet 'scratch' cell. I can then
extract the shape's cell value and the pages scratch value in the same units
and amke the comparison.

However, a 'parse'-style function might make a nice extension to Visio's VBA
in the future.

Susan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top