This VBA macro loops through all the shapes on the active Visio page and prints the text content of each shape's characters to the Immediate window.

The macro first declares a variable of type Visio.Characters, which represents the text content of a shape. It then uses a loop to iterate through each shape on the active page, retrieves the Characters object for each shape, and prints its text content to the Immediate window using the Debug.Print statement.

This macro can be useful for quickly inspecting the text content of shapes in a Visio diagram.

Sub Macro2()

    Dim vsoCharacters1 As Visio.Characters

    Dim i As Integer

    For i = 1 To Application.ActivePage.Shapes.Count

        Set vsoCharacters1 = Application.ActiveWindow.Page.Shapes.ItemFromID(i).Characters
        Debug.Print vsoCharacters1.Text

    Next

End Sub
VBA Macro to Print Shape Text in Visio

原文地址: https://www.cveoy.top/t/topic/njFl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录