Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Obtiene el valor de una celda ShapeSheet expresado en forma de cadena. Solo lectura.
Sintaxis
expresión. ResultStr (UnitsNameOrCode)
Expresión Variable que representa un objeto Cell .
Parameters
| Nombre | Obligatorio/opcional | Tipo de datos | Descripción |
|---|---|---|---|
| UnitsNameOrCode | Obligatorio | Variant | Unidades que se utilizarán al recuperar el valor. |
Valor devuelto
Cadena
Comentarios
Obtener la propiedad ResultStr es similar a obtener la propiedad Result de una celda. La diferencia estriba en que la propiedad ResultStr devuelve una cadena como valor de la celda, mientras que la propiedad Result devuelve un número de punto flotante.
Puede especificar UnitsNameOrCode como un entero o un valor de cadena. Si la cadena no es válida, se generará un error. Por ejemplo, todas las instrucciones siguientes establecen UnitsNameOrCode en pulgadas.
stringReturned = Cell.ResultStr (visInches)
stringReturned = Cell.ResultStr (65)
stringReturned = Cell.ResultStr ("in") donde "in" también puede ser cualquiera de las cadenas alternativas que representan pulgadas, como "inch", "in", o "intCounter".
Para obtener una lista completa de las cadenas de unidad válidas junto con las constantes de automatización (valores enteros) correspondientes, vea el tema sobre las unidades de medida.
Las constantes de automatización para representar unidades se declaran mediante la biblioteca de tipos de Visio en visUnitCodes miembro.
Basta con pasar un cero (0) para obtener el valor de las celdas de cadena de texto.
Use la propiedad ResultStr para convertir entre unidades. Por ejemplo, puede obtener el valor en pulgadas y, a continuación, obtener un valor equivalente en centímetros.
La propiedad ResultStr resulta útil para rellenar controles, cómo cuadros de edición con el valor de una celda.
Ejemplo:
Esta macro de Microsoft Visual Basic para Aplicaciones (VBA) muestra dos maneras diferentes de utilizar la propiedad ResultStr para obtener el valor de una celda ShapeSheet que contiene la propiedad personalizada de una forma.
Para ejecutar esta macro, abra un dibujo en blanco y la galería de símbolos Equipos y monitores (unidades de EE.UU.) y, a continuación, inserte un formulario de usuario que contenga una etiqueta, un cuadro de texto y un cuadro de lista. Establezca el ancho del cuadro de lista en 150.
Nota:
La galería de símbolos Equipos y monitores (unidades de EE. UU.) solo está disponible en Visio Profesional.
Public Sub ResultStr_Example()
Dim vsoStencil As Visio.Document
Dim vsoMaster As Visio.Master
Dim vsoPages As Visio.Pages
Dim vsoPage As Visio.Page
Dim vsoShape As Visio.Shape
Dim vsoCell As Visio.Cell
Dim intRows As Integer
Dim intCounter As Integer
'Get the Pages collection for the document.
'ThisDocument refers to the current document.
Set vsoPages = ThisDocument.Pages
'Get a reference to the first page of the Pages collection.
Set vsoPage = vsoPages(1)
'Get the Document object for the stencil.
Set vsoStencil = Documents("Comps_U.VSS")
'Get the Master object for the desktop PC shape.
Set vsoMaster = vsoStencil.Masters("PC")
'Drop the shape in the approximate middle of the page.
'Coordinates passed to the Drop method are always in inches.
'The Drop method returns a reference to the new shape object.
Set vsoShape = vsoPage.Drop(vsoMaster, 4.25, 5.5)
'This example shows two methods of extracting shape data.
'The first method retrieves the value of a shape-data item by name.
'Note that Prop.Manufacturer implies Prop.Manufacturer.Value.
Set vsoCell = vsoShape.Cells("Prop.Manufacturer")
'Get the cell value as a string
'and put it into the text box on the form.
UserForm1.TextBox1.Text = vsoCell.ResultStr(Visio.visNone)
'Set the caption of the label.
UserForm1.Label1.Caption = "Prop.Manufacturer"
'The second method of accessing shape data uses
'section, row, cell. This method is best when you want
'to iterate through all the shape data.
intRows = vsoShape.RowCount(Visio.visSectionProp)
'Make sure the list box is cleared.
UserForm1.ListBox1.Clear
'Loop through all the rows and add the value of Prop.Manufacturer
'to the list box. Rows are numbered starting with 0.
For intCounter = 0 To intRows - 1
Set vsoCell = vsoShape.CellsSRC(Visio.visSectionProp, intCounter, visCustPropsValue)
UserForm1.ListBox1.AddItem vsoCell.LocalName & vbTab & _
vsoCell.ResultStr(Visio.visNone)
Next intCounter
'Display the user form.
UserForm1.Show
End Sub
Soporte técnico y comentarios
¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.