Option Explicit
Private Sub UserForm_Initialize()
Dim ii As Double, jj As Double
ii = CDbl(GetSetting("DS", "Razlu4niK", "WindowX", 75))
UFBreak.Left = ii
jj = CDbl(GetSetting("DS", "Razlu4niK", "WindowY", 75))
UFBreak.Top = jj
End Sub
Sub cmdBreak_Click()
Set srSel = ActiveSelection.Shapes.FindShapes(Query:="@type ='text:artistic' or @type ='text:paragraph'")
Set srAll = ActivePage.Shapes.FindShapes(Query:="@type ='text:artistic' or @type ='text:paragraph'")
Optimization = True
ActiveDocument.BeginCommandGroup "Razlu4niK"
EventsEnabled = False
ActiveDocument.PreserveSelection = False
ActiveDocument.SaveSettings
'Break to Line
Set srLine = srSel.Shapes.FindShapes(Query:="@com.text.story.Lines.Count > 1")
For Each s In srLine
On Error Resume Next
s.Text.ConvertToArtistic
s.BreakApart
Next s
If chkLine.Value = True Then
GoTo ExSub:
Else
Set srWord = ActivePage.Shapes.FindShapes(Query:="@type ='text:artistic' or @type ='text:paragraph'")
srAll.RemoveRange srSel
srWord.RemoveRange srAll
End If
'Break to Word
For Each s In srWord.Shapes.FindShapes(Query:="@com.text.story.Words.Count > 1")
s.BreakApart
Next s
If chkWord.Value = True Then
GoTo ExSub:
Else
Set srChar = ActivePage.Shapes.FindShapes(Query:="@type ='text:artistic' or @type ='text:paragraph'")
srAll.RemoveRange srSel
srChar.RemoveRange srAll
End If
'Break to Characters
For Each s In srChar.Shapes.FindShapes(Query:="@com.text.story.Characters.Count > 1")
s.BreakApart
Next s
ExSub:
ActiveDocument.RestoreSettings
ActiveDocument.PreserveSelection = True
EventsEnabled = True
Optimization = False
ActiveWindow.Refresh
Application.Refresh
ActiveDocument.EndCommandGroup
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
SaveSetting "DS", "Razlu4niK", "WindowX", CStr(Left)
SaveSetting "DS", "Razlu4niK", "WindowY", CStr(Top)
End Sub