use vba to turn a list of words into cells in a word table

Assuming that you have pasted each word into a new paragraph there is no need to loop through anything. You simply need to convert the paragraphs into a table:

Sub MispeltWordsTable()
   With ActiveDocument.Content
      With .ConvertToTable(Separator:=wdSeparateByParagraphs, NumColumns:=1, _
         NumRows:=.Paragraphs.Count, AutoFitBehavior:=wdAutoFitFixed)
         .style = "Table Grid"
         .ApplyStyleHeadingRows = True
         .ApplyStyleLastRow = False
         .ApplyStyleFirstColumn = True
         .ApplyStyleLastColumn = False
         .Columns.add
         .PreferredWidthType = wdPreferredWidthPercent
         .PreferredWidth = 100
      End With
   End With
End Sub

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top