TPE

http://bayanbox.ir/view/263405954590585756/2mobile.png

Tavvafi@gmail.com


≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

Option Explicit
Public atabs() As String

Sub GetTabStops()
' Select the text whose tab stops you want to pick up then run this macro

    Dim x As Long
    With ActiveWindow.Selection.ShapeRange(1)
        With .TextFrame.Ruler
            Debug.Print .TabStops.Count
            If .TabStops.Count > 0 Then
               ReDim atabs(2, 1 To .TabStops.Count) As String
               For x = 1 To .TabStops.Count
                   Debug.Print .TabStops(x).Position & vbTab & .TabStops(x).Type
                   atabs(1, x) = CStr(.TabStops(x).Position)
                   atabs(2, x) = CStr(.TabStops(x).Type)
               Next
            End If
        End With
    End With

End Sub

Sub SetTabStops()
' Run this macro to apply the memorized tab stops to the selected text

    Dim x As Long
    With ActiveWindow.Selection.ShapeRange(1)
        With .TextFrame.Ruler
            For x = 1 To .TabStops.Count
                .TabStops(x).Clear
            Next
            For x = 1 To UBound(atabs, 2)
                .TabStops.Add Type:=CLng(atabs(2, x)), Position:=CDbl(atabs(1, x))
            Next
        End With
    End With
End Sub