|
|
Subject:
MS Word: How to modify all tables in a document
Category: Computers > Software Asked by: rambler-ga List Price: $8.00 |
Posted:
09 Sep 2006 17:50 PDT
Expires: 09 Oct 2006 17:50 PDT Question ID: 763791 |
Every day, I modify a Word document that contains several tables. (It's a new document every day, with new tables.) I have a macro that can modify any given table the way that I want, but the macro operates on only one table at a time. How can I revise the macro so that it modifies ALL of the tables in the document? |
|
There is no answer at this time. |
|
Subject:
Re: MS Word: How to modify all tables in a document
From: tonyyin-ga on 14 Sep 2006 02:30 PDT |
Write VBA code to go through all tables. I can do that for you if you send me your Macrol. |
Subject:
Re: MS Word: How to modify all tables in a document
From: tonyyin-ga on 14 Sep 2006 04:02 PDT |
Hi Rambler, You can try to modify your Macro like this: Sub YourMacro() ' ' YourMacro Macro ' Dim i As Integer For i = 1 To ActiveDocument.Tables.Count ActiveDocument.Tables(i).Select ' Your code below .... Selection.Tables(1).xxx = xxx Selection.Tables(1).xxx = xxx .... ' Your code above Next End Sub Let me know if you have any difficaulty in executing it. Best regards, Tony |
Subject:
Re: MS Word: How to modify all tables in a document
From: rambler-ga on 14 Sep 2006 08:58 PDT |
Tony, Thanks for the suggested code, but I'm having a problem with it. Here is the resulting code (yours and mine together): Sub TableFreezeSize() Dim i As Integer For i = 1 To ActiveDocument.Tables.Count ActiveDocument.Tables(i).Select Selection.Tables(i).AutoFitBehavior (wdAutoFitFixed) Next End Sub When I execute the code, I get Run-time error '5941': The requested member of the collection does not exist. When I click on debug, the line that is highlighted is Selection.Tables(i).AutoFitBehavior (wdAutoFitFixed) Any ideas? (Thanks again for your assistance. I greatly appreciate it.) |
Subject:
Re: MS Word: How to modify all tables in a document
From: rambler-ga on 14 Sep 2006 09:22 PDT |
Never mind. I figured it out. Here is the code that works: Dim i As Integer For i = 1 To ActiveDocument.Tables.Count ActiveDocument.Tables(i).Select ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitFixed) Next Thank you, Tony, for your help. |
Subject:
Re: MS Word: How to modify all tables in a document
From: tonyyin-ga on 14 Sep 2006 16:48 PDT |
You can use either: ActiveDocument.Tables(i).Select Selection.Tables(1).AutoFitBehavior (wdAutoFitFixed) or: ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitFixed) |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |