D
denapple
I'm a newcomer to this forum. Trying to review/learn more about VBA i
Word with "Using Microsoft Word 97" book, which has some VBA in th
back. I think the book has a typo or two, because everytime I run it
it goes into an infinite loop. Where do I make the condition tur
false? This is supposed to go through a Word doc looking for tables
and them applying the autoformat to each of them.
Sub FormatTableContemporary()
Selection.HomeKey Unit:=wdStory
Application.Browser.Target = wdBrowseTable
MoreTables = True
Do While MoreTables = True
Application.Browser.Next
On Error Resume Next
Selection.Tables(1).Select
If Err = 1594 Then
MoreTables = False
Else
Selection.Tables(1).AutoFormat
Format:=wdTableFormatContemporary, _
applyborders:=True, _
applyshading:=True, _
applyfont:=True, _
applycolor:=True, _
applyheadingrows:=True, _
applylastrow:=False, _
applyfirstcolumn:=True, _
applylastcolumn:=False, _
AutoFit:=True
Selection.MoveDown Unit:=wdLine, Count:=1
Loop
End Sub
Also, I like to type things in lower case, knowing the VB editor wil
capitalize words it recognizes as needed. Sort of a spellcheck fo
myself. This one only capitalized a few of the properties. I
something wrong?
Thanks for your help
Word with "Using Microsoft Word 97" book, which has some VBA in th
back. I think the book has a typo or two, because everytime I run it
it goes into an infinite loop. Where do I make the condition tur
false? This is supposed to go through a Word doc looking for tables
and them applying the autoformat to each of them.
Sub FormatTableContemporary()
Selection.HomeKey Unit:=wdStory
Application.Browser.Target = wdBrowseTable
MoreTables = True
Do While MoreTables = True
Application.Browser.Next
On Error Resume Next
Selection.Tables(1).Select
If Err = 1594 Then
MoreTables = False
Else
Selection.Tables(1).AutoFormat
Format:=wdTableFormatContemporary, _
applyborders:=True, _
applyshading:=True, _
applyfont:=True, _
applycolor:=True, _
applyheadingrows:=True, _
applylastrow:=False, _
applyfirstcolumn:=True, _
applylastcolumn:=False, _
AutoFit:=True
Selection.MoveDown Unit:=wdLine, Count:=1
Loop
End Sub
Also, I like to type things in lower case, knowing the VB editor wil
capitalize words it recognizes as needed. Sort of a spellcheck fo
myself. This one only capitalized a few of the properties. I
something wrong?
Thanks for your help