Are you sure Data1 can contain up to 64 KB of characters?

Started by Croc, March 11, 2022, 06:20:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Croc

That's what it says in the documentation
https://docs.microsoft.com/en-us/office/vba/api/visio.shape.data1
QuoteRemarks
Use the Data1 property to supply additional information about a shape. The property can contain up to 64 KB of characters. Text controls should be used with care with a string that is greater than 3,000 characters. Setting the Data1 property is equivalent to entering information in the Data 1 box in the Special dialog box.

I have a question, what will happen if I try to write more than 64 KB to Data1. What error will occur?
I took a 1342 KB file and put it in Data1.
Then I output the data back to the file.
The result matched the original file. That is, the volume of 1342 KB fit into the Data1 cell. There was no error.
I used this macro.
Sub ttt2()
    iFF = FreeFile()
    Open "C:\data1\praktikantka.fb2" For Input As #iFF
    s = Input(LOF(iFF), iFF)
    Close #iFF
   
    len1 = Len(s)
    Debug.Print len1
    ActiveDocument.DocumentSheet.Data1 = s
    sRev = ActiveDocument.DocumentSheet.Data1
    len2 = Len(sRev)
    Debug.Print len2
   
    iFF2 = FreeFile()
    Open "C:\data1\praktikantka_rev.fb2" For Output As #iFF2
    Print #iFF2, sRev
    Close #iFF2
End Sub

wapperdude

Never looked at this.  Could it be KB vs Kb...a factor of 8x???
Visio 2019 Pro