Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2019, 04:25 PM
Guessed's Avatar
Guessed Guessed is offline Replace style in all tables in a word document. Windows 10 Replace style in all tables in a word document. Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default


In that case, you must also have other shapes in your document that don't contain text frames. Try this klunky version to handle that
Code:
Sub ApplyTableStyle()
  Dim t As Table, aShp As Shape
  For Each t In ActiveDocument.Tables
    t.Style = "Light Shading - Accent 3"
  Next
  On Error GoTo JumpJump
  For Each aShp In ActiveDocument.Shapes
    For Each t In aShp.TextFrame.TextRange.Tables
      t.Style = "Light Shading - Accent 3"
    Next t
JumpJump:
    Err.Clear
  Next aShp
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace style in all tables in a word document. Using tables in a Word document oldyeller1938 Word Tables 4 03-17-2018 01:42 AM
Tables in Word Document - Formatting Networkrail Word Tables 0 08-22-2017 05:49 AM
When changing table style in Word 2010, font size seems to change but doesn't show in new tables heartsoulliving Word 1 12-07-2016 05:17 PM
Adding tables to Created word document whilst other word document open Help rpb925 Word VBA 18 03-30-2016 04:45 PM
Replace style in all tables in a word document. Use multiple style sets in the same Word document (depending on which section the style is in) Ricyteach Word VBA 6 03-09-2015 07:11 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft