Value of a cell instead of it'S formula - FormulaU

Started by Yacine, January 13, 2013, 08:18:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

Hi,
While porting a visio solution from visio 2003 to 2007, I faced a problem with the formula property of the cell object.
The shape data have a row formated as fixed list. Thus the formula of the value field is "index(n, prop.myprop.format)"
Now when trying to get the result (string) of this formula I get only the formula itself.
myResultStr = myShape.Cells(FieldName).FormulaU
In V2003 (and my work environment) it works perfectly.
Any idea anyone?
Yacine

Jumpy

I only know Visio2007 an higher and I don't know it any different.
Formula returns the formula as String.
Therefore I have to use cell.Result or cell.ResultStr do get a value.

Maybe users that know the older versions of Visio can explain, why the behaviour is different in 2003.

vojo

isnt one suppose to use RESULT if they want the value....vs....FORMULA???

Paul Herber

As far as I know .Formula and FormulaU have always returned the formula and .Result and .ResultU have always returned the result in the units specified. And .ResultStr has always returned the result as a string.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Yacine

Thank you very much. "ResultStr(visUnitsString)" worked. It seems that I haven't checked carefully enough the other properties of the cell object.
But I definitely can confirm, that with V2003, Formula and FormulaU give the value displayed in the shape data window and not the formula.
Thanks again,
Y.
Yacine

vojo

RE 2003....I am 99.99999% sure formula gives forumla not value

I remember writing a bunch of VBA for visio 2003 cells and the toughest part was translating the value to something VBA could use
(""" - that could have been done better ;0  )
I will try to dig up to confirm....almost absolutely sure I needed to use results.

Note, I do recall that, depending on constraints, visio 2003 would return funny things

like I said, getting the true values was the tough nut to crack when did some stuff about 4 years ago.

JuneTheSecond

I picked out the old pc from my warehouse, and run Visio 2003.
And confirmed just as Yacine wrote that all the
shp.Cells(" Prop.test").FormulaU,
shp.Cells(" Prop.test").Formula,
shp.Cells(" Prop.test").ResultStr("")
gave the result but not formula in the Prop.Value cell,
"INDEX(3,Prop.test.Format)".

I think it was a bug in Visio 2003,
because you could not get formula, even if you wish.
Now, I think the bug is fixed in newer versions.

Best Regards,

Junichi Yoda
http://june.minibird.jp/

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 270 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1141KB.
Tokens: post-login.
Cache hits: 13: 0.00159s for 26,587 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]