Write strings in shapesheet

Started by davidgon, February 01, 2017, 03:57:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

davidgon

Hello!

It is probably this question is already solved, but I haven't found the solution. How could I put what I write in a textbox into a cell of the shapesheet? >The problem appears only when I write strings. With numbers I have no problem.

All I've tried return me an error. There's a similar post: http://visguy.com/vgforum/index.php?topic=3329.msg12997#msg12997 , but the line:
SetCellValueToString vsoCell, CStr(varValue)
returns me an error

Thanks

Surrogate


OldSchool1948

Are you putting quotes around the string?  For example:

Const QT As String = """"

QT & Trim(CStr(varValu)) & QT

davidgon

Yes, vba

Yes, I have tried it but it doesn't work.

Yacine

#4
myShape.cells("someCell").formulaU = chr(34) & "Tralala" & chr(34)
You will of course check first if the cell exists with myShape.cellexists("someCell", false)
Yacine

OldSchool1948

This works for me every time when updating or creating on the fly User-defined section rows.



Sub AddUpd_UserDefinedRow(RowName As String, RowValue As String)

'Get Row ID
If Not vsoShape.CellExists("User." & RowName, 0) Then
    'Add action row if it does not exist
    iRow = vsoShape.AddNamedRow(visSectionUser, RowName, 0)
Else
    'Retrieve Row number reference if row exists
    iRow = vsoShape.CellsRowIndex("User." & RowName)
End If
       
vsoShape.CellsSRC(visSectionUser, iRow, visUserValue).formula = QT & RowValue & QT

End Sub

[\code]

davidgon