Visio Guy

Visio Discussions => Programming & Code => Topic started by: lindir on May 21, 2015, 07:34:02 AM

Title: Field Formula and space in shape nam
Post by: lindir on May 21, 2015, 07:34:02 AM
Hello guys!

I have a text bloc and I insert a field to get a result from data of another shape:

=ROUND(EVALCELL(MyShape!Prop._VisDM_TempsPasse)/EVALCELL(MyShape!Prop._VisDM_TAI),3)*100&"%"


The Problem is that I have a shapeName with Space exemeple( My Shape name has space ) and Evalcell doesn't work when there is space.

Any solution ??
Title: Re: Field Formula and space in shape nam
Post by: Surrogate on May 21, 2015, 08:33:19 AM
try use syntax Sheet.<ID of your shape> instead My Shape name
Title: Re: Field Formula and space in shape nam
Post by: JohnGoldsmith on May 21, 2015, 09:07:26 AM
Hi,

Are you sure you're wanting to use EVALCELL in the first place?  Normally you would use this function in conjunction with arguments using the ARG  function.  If you just want the value of another cell wouldn't a direct reference work just as well, or have I missed something (quite possibly)?

The following works ok for me:

'In Sheet.1
User.Sum = EVALCELL(A Shape!User.fxAdd,"A",3,"B",4)

'In shape named 'A Shape'
User.fxAdd = ARG("A")+ARG("B")


I would be tempted to put some of your field formula into a User cell and then reference this in your field.  That way you can check which intermediate parts are working and it might be clearer what the logic is when you come back to it in six months time.

Hope that helps.

Best regards

John
Title: Re: Field Formula and space in shape nam
Post by: JohnGoldsmith on May 21, 2015, 09:24:34 AM
Actually, I've just realised you're talking about a shape with a preceeding and trailing space character - is that right?

In that case you'll need to surround the name in single quotes.  For example:

User.Sum = EVALCELL(' A Shape '!User.fxAdd,"A",3,"B",4)

I can also reproduce the error when changing the name of the shape and it looks like like EVALCELL is looking at the universal name of the shape rather than the local one.

Do your shape names match in your case or have they got out of sync?

If that's the case you can either:
Best regards

John
Title: Re: Field Formula and space in shape nam
Post by: lindir on May 27, 2015, 07:21:51 AM
Thanks you so much your help, I will try your solutions.
Best regards,

Lidnir