Visio Guy

Visio Discussions => Programming & Code => Topic started by: Visisthebest on January 04, 2021, 01:30:35 PM

Title: Maximum string size in shapesheet user field
Post by: Visisthebest on January 04, 2021, 01:30:35 PM
I see that a shape data cell/field can store a string of up to 64kb:
https://bvisual.net/2015/07/24/formatting-shape-data-in-visio/

Can a shapesheet user cell also store a 64kb string (obviously a 64kb string as a result, not a formula although that would be impressive for a formula length! 8) )

Thank you for your help!
Title: Re: Maximum string size in shapesheet user field
Post by: Visisthebest on January 04, 2021, 04:18:25 PM
Yup it is 64kb you can verify this with the code below.

(select a shape with the User.visVersion cell you can add, Microsoft's Basic Block shapes have this field in Visio 2019 by default)


Sub CramALargeStringIntoUserCell()

Dim zerototen As String

zerototen = "0123456789"

Dim largestring As String

Dim Counter As Long

For Counter = 1 To 6553

largestring = largestring & zerototen

Next Counter

Dim SomeCell As Visio.Cell

Set SomeCell = Application.ActiveWindow.Selection(1).Cells("User.visVersion")

SomeCell.FormulaForce = Chr(34) & largestring & Chr(34)

End Sub