Visio Guy

Visio Discussions => General Visio => Topic started by: Yacine on January 13, 2013, 08:18:32 PM

Title: Value of a cell instead of it'S formula - FormulaU
Post by: Yacine on January 13, 2013, 08:18:32 PM
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?
Title: Re: Value of a cell instead of it'S formula - FormulaU
Post by: Jumpy on January 14, 2013, 08:39:27 AM
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.
Title: Re: Value of a cell instead of it'S formula - FormulaU
Post by: vojo on January 14, 2013, 01:44:43 PM
isnt one suppose to use RESULT if they want the value....vs....FORMULA???
Title: Re: Value of a cell instead of it'S formula - FormulaU
Post by: Paul Herber on January 14, 2013, 02:54:16 PM
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.
Title: Re: Value of a cell instead of it'S formula - FormulaU
Post by: Yacine on January 14, 2013, 09:00:20 PM
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.
Title: Re: Value of a cell instead of it'S formula - FormulaU
Post by: vojo on January 14, 2013, 10:32:53 PM
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.
Title: Re: Value of a cell instead of it'S formula - FormulaU
Post by: JuneTheSecond on January 15, 2013, 06:43:02 AM
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.

Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 58 (show)
Files included: 25 - 925KB. (show)
Memory used: 770KB.
Tokens: post-login.
Cache hits: 6: 0.00090s for 22,292 bytes (show)
Cache misses: 1: (show)
Queries used: 8.

[Show Queries]