Re: Use of function .Cells and .CellsSRC with Visio and VB



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.

"Fred" <Fred@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9E1FB42E-E5CE-49ED-88A3-731DB66A63B4@xxxxxxxxxxxxxxxx
> 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


.



Relevant Pages

  • Re: Formulas containing hard coded values
    ... Dim R As Range, sdoit As String ... MsgBox "Cell contains hard codes" ... Dim Fml As String, LCtext As String ... For Each Rng In R.Precedents.Areas ...
    (microsoft.public.excel.programming)
  • VB, implementing the high score within this code
    ... Private possibleAs String ... Private Function SolvePuzzleAs Boolean ... ' Calculates the possible values for all the cell ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Marking points read for coordinates
    ... In "Private Sub GetCoordinates()" comment all the code between ... (ByVal lpClassName As String, ByVal lpWindowName As String) ... ' cell A1 which is the base for all object coordinates on a sheet. ... Dim chtObj As ChartObject ...
    (microsoft.public.excel.programming)
  • Re: Text formatted cells displaying numbers in scientific format
    ... When it 'sees' a large number it uses scientific format since ... I accept that Excel can't handle numbers greater than 15 digits and your ... string was 16 digits or more to be converted to a scientific value. ... It just doesn't display correctly in the cell (except after entering ...
    (microsoft.public.excel)
  • Re: Parsing and Counting Matches - My State Table.xls (0/1)
    ... ' Search for occurance in a Cell of a string found in a specific Cell ... ' Need nested loops to traverse both the Search Cell and the String Cells. ... Dim CellString As String 'Cell to search ... CellRow = 2 ' Initialize Cell Row ...
    (microsoft.public.excel)