Setting formula in German locale from vb

D

dblyth2007

Hi,

I have a simple VB6 application that automates some drawing functions in a
Visio. My tests are with Visio 2002 SP2 and above as most of the people using
this are still on this version.

I've spent the last through days trying to get through all the problems that
crop up when I try to run the application with my regional number settings
set to German, where the ',' and '.' are reversed for example.

I have a line of code that makes up a function to draw a connector between
two points.

vsoBeginCellX.formula = "PAR(PNT(" & TempName & _
"!Connections.IN" & InputNumber & ".X," & TempName & _
"!Connections.IN" & InputNumber & ".Y))"

The variables TempName and InputNumber are ofcourse substituted by strings.
The formula is infact being set to:

"PAR(PNT(SHAPE A!Connections.IN1.X,SHAPE A!Connections.IN1.Y))"

This works ok for UK settings, but falls over with German. I've done a bit
of searching and tried putting in extra " (or chr(34), I've also tried using
'formulaU' but I get the ?NAME error even with UK settings.

The X and Y settings are normally stored in CM with standard UK/US
delimeters, I guess either the PNT, PAR or general formula property is not
dealing with this when the delimeter is a comma for the decimal point (when
doc is created with German locale).

Elsewhere in my program I've used the vb 'replace' function to convert the
delimeter to a '.' for any number calculations, but I don't know how to try
this within a formula, or if indeed that is the direction to look.

Any help in this area is appreciated.

regards

dblyth2007
UK
 
V

visiSteve

Hi,

I have a simple VB6 application that automates some drawing functions in a
Visio. My tests are with Visio 2002 SP2 and above as most of the people using
this are still on this version.

I've spent the last through days trying to get through all the problems that
crop up when I try to run the application with my regional number settings
set to German, where the ',' and '.' are reversed for example.

I have a line of code that makes up a function to draw a connector between
two points.  

vsoBeginCellX.formula = "PAR(PNT(" & TempName & _
    "!Connections.IN" & InputNumber & ".X," & TempName & _
    "!Connections.IN" & InputNumber & ".Y))"

The variables TempName and InputNumber are ofcourse substituted by strings.
The formula is infact being set to:

"PAR(PNT(SHAPE A!Connections.IN1.X,SHAPE A!Connections.IN1.Y))"

This works ok for UK settings, but falls over with German. I've done a bit
of searching and tried putting in extra " (or chr(34), I've also tried using
'formulaU' but I get the ?NAME error even with UK settings.

The X and Y settings are normally stored in CM with standard UK/US
delimeters, I guess either the PNT, PAR or general formula property is not
dealing with this when the delimeter is a comma for the decimal point (when
doc is created with German locale).

Elsewhere in my program I've used the vb 'replace' function to convert the
delimeter to a '.' for any number calculations, but I don't know how to try
this within a formula, or if indeed that is the direction to look.

Any help in this area is appreciated.

regards

dblyth2007
UK

The problem could actually be with the names of the shapes you're
passing in, eg. "SHAPE A". Do you know for sure that a shape exists
with that name? Is that name the "universal" name of the shape or its
localized name?

I would strongly recommend using .FormulaU to set the formulas, and
then use US/UK formatting conventions in your scenario. Just make
sure you're also using the universal name of the shape in the
formula. I've seen before where I actually have to use the shape's
NameID, such as "Sheet.5" instead of a more descriptive name in a
formula, especially since there are spaces in the descriptive name.
Visio then replaces that sheet name with the more-descriptive name
when I view it in the ShapeSheet.
 
A

Andy

The problem could actually be with the names of the shapes you're
passing in, eg. "SHAPE A".  Do you know for sure that a shape exists
with that name?  Is that name the "universal" name of the shape or its
localized name?

I would strongly recommend using .FormulaU to set the formulas, and
then use US/UK formatting conventions in your scenario.  Just make
sure you're also using the universal name of the shape in the
formula.  I've seen before where I actually have to use the shape's
NameID, such as "Sheet.5" instead of a more descriptive name in a
formula, especially since there are spaces in the descriptive name.
Visio then replaces that sheet name with the more-descriptive name
when I view it in the ShapeSheet.

You need to be using FormulaU, but also you have to use the universal
names for the shapes and connections, e.g. Connection.Row_1 etc
 

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