Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 03-22-2021, 06:02 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline How to script most table column in word document? Windows 10 How to script most table column in word document? Office 2019
Competent Performer
How to script most table column in word document?
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default

Eurrrrrrrrrrrrrrrreka
I found it
Not certain what I'm doing, but I've played with it so much, it was Trial and Error.

Code:
  Dim i As Integer, x As Integer, iTbl As Integer, sOthers As String
  For i = 1 To ActiveDocument.Tables.Count
    If ActiveDocument.Tables(i).Columns.Count > x Then
      x = ActiveDocument.Tables(i).Columns.Count
      iTbl = i
      sOthers = ""
    ElseIf ActiveDocument.Tables(i).Columns.Count = x Then
      sOthers = sOthers & ""
    End If
  Next i

  MsgBox "The table with the most columns is " & x & " Columns."
    
    On Error GoTo 0
I didn't really need to know about the others, so I've played with it, until I didn't see Red, or an Error message.

OMG Thank you so much.

Million appreciations for your guidance and help.

What I've put, does it makes sense to you both?

Cendrinne
Reply With Quote
 

Tags
help please, most table column



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to add final touches to merged document, after running MailMergeToDoc script NicB Word VBA 1 09-02-2020 05:47 PM
How to generate a word document with a table-script valdavaux Word 1 09-17-2017 03:32 PM
Is it possible to put a formula in a table column header to define the name of the column? JacquesW Excel 3 05-08-2017 08:00 AM
VBA to search each row of a word table column Marrick13 Word VBA 7 11-17-2014 04:33 AM
How to script most table column in word document? two column word document. plato Word 1 08-06-2010 04:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:53 AM.


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