1

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. :)

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
Yanoush
  • 11
  • 2

0 Answers0