My VBA code running forever has stopped working properly.
Anyone else having problems?
Perhaps someone could run this simple experiment that demos the problem on latest Visio version and runs correctly on earlier version.
Visio Version 2203 (Build 15028.20204)
Shape with text:0123456789 30 pt.
Shape sheet 1 character line.
Start recording.
Change 456 to 8 pt.
Stop recording.
Shape sheet 3 characters, 4 3 4, 30 8 30
Use ctrl-z to get back to all 30
Shape sheet back to 1 character line.
Run macro.
Observe all 8 pt.
Shape sheet 1 line 8.
Sub Macro1()
'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150
Dim UndoScopeID2 As Long
UndoScopeID2 = Application.BeginUndoScope("Font Size")
Dim vsoCharacters1 As Visio.Characters
Set vsoCharacters1 = Application.ActiveWindow.Page.Shapes.ItemFromID(8).Characters
vsoCharacters1.Begin = 4
vsoCharacters1.End = 7
vsoCharacters1.CharProps(visCharacterSize) = 8#
Application.EndUndoScope UndoScopeID2, True
'Restore diagram services
ActiveDocument.DiagramServicesEnabled = DiagramServices
End Sub
***************************
Earlier version works properly.
Visio Version 2108 (Build 14326.20238)
Shape with text:0123456789 30 pt.
Shape sheet 1 character line.
Start recording.
Change 456 to 8 pt.
Stop recording.
Shape sheet 3 characters, 4 3 4, 30 8 30
Use ctrl-z to get back to all 30
Shape sheet back to 1 character line.
Run macro.
Observe correct -- 0123 30 pt, 456 8 pt, 789 30 pt.
Shape sheet 3 characters, 4 3 4, 30 8 30
Recorded macro looks identical to me.
Sub Macro1()
'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150
Dim UndoScopeID2 As Long
UndoScopeID2 = Application.BeginUndoScope("Font Size")
Dim vsoCharacters1 As Visio.Characters
Set vsoCharacters1 = Application.ActiveWindow.Page.Shapes.ItemFromID(8).Characters
vsoCharacters1.Begin = 4
vsoCharacters1.End = 7
vsoCharacters1.CharProps(visCharacterSize) = 8#
Application.EndUndoScope UndoScopeID2, True
'Restore diagram services
ActiveDocument.DiagramServicesEnabled = DiagramServices
End Sub
Any help greatly appreciated.
Thanks.
Paul