Auto custom properties

K

Kware

Im trying to auto fill custom properties of my shapes I have managed to be
able to do this with numbers but when i try it with strings it will not work.
below is what i have if i change the ? to 65 and the company to 2 i will get
"2 in" in the field From reading i thought 231 would resolve this but it has
not. Thanks in advance for any help.

Dim visshape As Shape
Dim txtBOx As Shape
Dim company As String

Set txtBOx = Visio.ActivePage.Shapes("Sheet.21")
txtBOx.Text = "john"
Set visshape = Visio.ActiveWindow.Selection(1)
visshape.Cells("prop.Company").Result(?) = company
 
P

Paul Herber

Im trying to auto fill custom properties of my shapes I have managed to be
able to do this with numbers but when i try it with strings it will not work.
below is what i have if i change the ? to 65 and the company to 2 i will get
"2 in" in the field From reading i thought 231 would resolve this but it has
not. Thanks in advance for any help.

Dim visshape As Shape
Dim txtBOx As Shape
Dim company As String

Set txtBOx = Visio.ActivePage.Shapes("Sheet.21")
txtBOx.Text = "john"
Set visshape = Visio.ActiveWindow.Selection(1)
visshape.Cells("prop.Company").Result(?) = company

The .Result method wants a value of numeric type, to set a string use
the ResultStr method.
What you are doing is setting the result to 2 with the default
internal units (which are inches).
So, on the last line
....ResultStr("") = "a string"
or .. Result("mm") = 2
will set the cell to 2mm
 
K

Kware

Resultstr("") wont work its read only

Paul Herber said:
The .Result method wants a value of numeric type, to set a string use
the ResultStr method.
What you are doing is setting the result to 2 with the default
internal units (which are inches).
So, on the last line
....ResultStr("") = "a string"
or .. Result("mm") = 2
will set the cell to 2mm
 
A

Al Edlund

If my memory serves me correctly, result is meant for when I read a cell,
formula is for when I want to set a cell. (or something like that, it's
early here)

al
 
K

Kware

sorry about this but it wont work i get an error #NAME?
this is the code i have

Sub EditText()
Dim visshape As Shape
Dim txtBOx As Shape
Dim company As String

Set txtBOx = Visio.ActivePage.Shapes("Sheet.21")
txtBOx.Text = "johnny"
company = txtBOx.Text
Set visshape = Visio.ActiveWindow.Selection(1)
visshape.Cells("prop.Company").FormulaU = company


End Sub
 
J

John Goldsmith

As it's a string you need to set the formula as follows:

..FoumulaU = "=""" & company & """"

Best regards

John


John Goldsmith
www.visualSignals.co.uk

Kware said:
sorry about this but it wont work i get an error #NAME?
this is the code i have

Sub EditText()
Dim visshape As Shape
Dim txtBOx As Shape
Dim company As String

Set txtBOx = Visio.ActivePage.Shapes("Sheet.21")
txtBOx.Text = "johnny"
company = txtBOx.Text
Set visshape = Visio.ActiveWindow.Selection(1)
visshape.Cells("prop.Company").FormulaU = company


End Sub
 

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