Visio Guy

Visio Discussions => Visio Bugs (er...Issues) => Topic started by: Croc on August 20, 2017, 02:10:20 PM

Title: Error displaying text
Post by: Croc on August 20, 2017, 02:10:20 PM
Visio 2010. The VBA macro fills the shape's text.
The error lies in the fact that (sometimes!) the text is superimposed on the text of the master-shape instead of replacing it.
If a DoEvents statement is placed before the text is entered, the error disappears.
Fragment of the text of the program:
    For i = 1 To DataColl.Count
        Dim mas As Visio.Master
        Set mas = Stenc.Masters("axis")
        Dim shp As Visio.Shape
        Set shp = TgtShape.Drop(mas, 0, 0)
        shp.Cells("Width").FormulaForce = "Guard(" & BaseWidth & ")"
        shp.Cells("User.angle") = DataColl(i).angle
        shp.Cells("User.p1") = DataColl(i).p1
        shp.Cells("User.p2") = DataColl(i).p2
        shp.Cells("User.xBase") = xBase
        shp.Cells("User.yBase") = yBase
'    DoEvents
        shp.Text = DataColl(i).aName
        Set DataColl(i).shp = shp
    Next
The master-shape contains the text of 4 symbols - "aaaa". The new text consists of one character.
After dropping master onto page, the program passes to the shape the data that controls the calculation of 1-D EndPoints and Angle.
I guess that it's Visio fault.
The picture below is animated gif.