Hi my name is Jean-Francois,
I am now trying to edit a shape sheetusing a VBA macro. With the comand cellsU, I was able to write numbers down my shapesheet but I am not able to write a string. I would like to know if it is possible to write strings and if yes, how can I do so. Here is my code that works for numbers but not for strings. (i cut some pieces that are already working)
Thanks a lot ,
jf
Dim shp As Visio.Shape
Dim ntexte As String
Dim formes As Visio.Shape
Dim win As Visio.Window
Dim sel As Visio.Selection
Dim vsoShape As Visio.Shape
Dim formez As Shape
Dim nbformes
Set nbformes = Application.ActivePage.Shapes
Set win = Visio.ActiveWindow
Set sel = win.Selection
ntexte = Me.TextBox1.text
If Me.OptionButton2.Value = True Then
For i = 1 To nbformes.Count
Set formez = Application.ActivePage.Shapes.Item(i)
If formez.CellExists("prop.CP", True) Then
formez.CellsU("prop.CP") = ntexte
End If
Next i
End If
End Sub
Try this:
formez.CellsU("prop.CP").Formula = """"+ntexte+""""
François-Félix
ou encore mieux chr(34) au lieu de """" ;)
aussi "&" au lieu de "+" pour des strings. ;) ;)