Discussion:
Use of function .Cells and .CellsSRC with Visio and VB
(too old to reply)
Fred
2005-11-03 19:06:05 UTC
Permalink
I'm using the custom properties section to store data from a Access Database.
When I try to retrieve that data with a vb program using either .Cells or
.CellsSRC I am only succesfull if the value field of the cust prop has a
number (integer or real) in it. If the value is a string, both functions
return a zero.

prop.input1.value = 13 ...... both functions return 13
prop.input1.value = XSEL ... both functions return 0


Any ideas?

Thanks
--
Fred
Mark Nelson [MS]
2005-11-04 08:15:04 UTC
Permalink
Cells and CellsSRC are methods that return a Cell object, not a value. The
Cell object has a ResultIU property which is designated as the default
property for the object. Thus when you get a result from .Cells(cellName)
you are really getting .Cells(cellName).ResultIU. This property returns a
numeric value converted to Internal Units (typically inches).

You can retrieve a string from a cell by accessing the ResultStr property on
the Cell object. ResultStr requires a parameter specifying the units that
the string value should be converted to. For example,
.Cells(cellName).ResultStr(visFeet) would return a string value with feet
units: "3.15 ft." For strings that have nothing to do with unit-ed values,
use 0. For example, .Cells(cellName).ResultStr(0) might return a string
like "Apple".

To assign a string to a cell, it is generally best to use the Formula
property on the Cell. Strings assigned as formulas must be enclosed in
quotation marks. To avoid confusion with the quotation marks that you wrap
strings in the VB editor with to identify them as strings, use Chr(34) to
represent a quotation mark. For example, .Cells(cellName).Formula = "=" +
Chr(34) + "Apple" + Chr(34) would assign the string value 'Apple' to the
cell.
--
Mark Nelson
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Fred
I'm using the custom properties section to store data from a Access Database.
When I try to retrieve that data with a vb program using either .Cells or
.CellsSRC I am only succesfull if the value field of the cust prop has a
number (integer or real) in it. If the value is a string, both functions
return a zero.
prop.input1.value = 13 ...... both functions return 13
prop.input1.value = XSEL ... both functions return 0
Any ideas?
Thanks
--
Fred
Loading...