Hyphenation Turn Off in Each Text Shapes MS Publisher

1.1k views Asked by At

I would like to turn of hyphenation (MS Publisher) in every shape containing a text.

I wrote a small code to highlight the text in each shape on each page one after the other:

Sub TurnOffHyphenation()

Dim pg As Long
Dim sp As Long
Dim shpAll As ShapeRange

pg = ActiveDocument.Pages.Count
   
For pg = 1 To pg

    sp = ActiveDocument.Pages(pg).Shapes.Count
     ActiveDocument.ActiveView.ActivePage = ActiveDocument.Pages(pg)

  For sp = 1 To sp
       
    ActiveDocument.Pages(pg).Shapes(sp).Select
     Set shpAll = Application.ActiveDocument.Selection.ShapeRange
        If shpAll.HasTextFrame = msoFalse Then
          'do nothing
        Else
            Selection.ShapeRange.TextFrame.TextRange.Select
       '<Action> => Hyphenation Turn Off 
        End If
    
  Next sp
Next pg
 
End Sub

is probably a one line which have to be completed.

Manual steps which have to be done in MS Publisher:

  1. Click the Text Box Tools Format tab, and then click Hyphenation
  2. In the Hyphenation dialog box, clear the Automatically hyphenate this story check box

This two steps I would like to transform into a macro code. :)

0

There are 0 answers