View Single Post
 
Old 06-07-2018, 03:02 AM
shu shu is offline Windows 10 Office 2016
Novice
 
Join Date: Jun 2018
Posts: 6
shu is on a distinguished road
Unhappy run through tables and format these

Hey

I'm new with vba word. I want to run trough tables and change some properties. I have a document with around 100 tables and when i start the makro, the word document has an error and shuts down after 20 - 30 tables. Can someone tell me why?

This is my code for it:

Code:
Sub Tabellen_formatieren()

Dim i As Integer
    
For i = 1 To ActiveDocument.Tables.Count
             ActiveDocument.Tables(i).Select
         
        With ActiveDocument.Tables(i).Range.Font
        .Name = "Arial"
        .Size = 10
        .ColorIndex = wdBlack
        End With
        
       With ActiveDocument.Tables(i)
       .PreferredWidthType = wdPreferredWidthPercent
       .PreferredWidth = 100
       End With
              
Next

End Sub

Last edited by macropod; 06-07-2018 at 04:35 PM. Reason: Added code tags
Reply With Quote