Author Topic: Error displaying text  (Read 3873 times)

0 Members and 1 Guest are viewing this topic.

Croc

  • Sr. Member
  • ****
  • Posts: 343
    • Visioport
Error displaying text
« on: August 20, 2017, 09:10:20 AM »
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:
Code
    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.
« Last Edit: August 20, 2017, 09:14:10 AM by Croc »