Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-10-2025, 04:08 PM
chrisjj chrisjj is offline Word 2003: Has anyone had success in accessing nested tables in a macro? Windows 7 64bit Word 2003: Has anyone had success in accessing nested tables in a macro? Office 97-2003
Competent Performer
Word 2003: Has anyone had success in accessing nested tables in a macro?
 
Join Date: Aug 2025
Posts: 120
chrisjj is on a distinguished road
Default Word 2003: Has anyone had success in accessing nested tables in a macro?

Not me. Even the simplest task fails for me. The attached has no nested tables yes VBA reports it has one.

Code:
Option Explicit

Sub CountFirstLevelNestedRows()
    Dim tbl As Table
    Dim rw As row
    Dim c As cell
    Dim nestedCount As Long
    Dim nt As Table
    
    nestedCount = 0
    
    ' Loop through all tables in the document
    For Each tbl In ActiveDocument.Tables
        ' Check each row for nested tables
        For Each rw In tbl.Rows
            For Each c In rw.Cells
                ' If this cell contains nested tables (first-level)
                If c.Range.Tables.count > 0 Then
                        MsgBox "Nested table !"
                End If
            Next c
        Next rw
    Next tbl
End Sub


Any help appreciated before I spend more time up what looks like a garden path...



Thanks.
Attached Files
File Type: doc Nested table detect FALSE +VE!.doc (43.0 KB, 3 views)
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2003: Has anyone had success in accessing nested tables in a macro? Search in Nested Tables to Delete Rows JingleBelle Word VBA 6 11-13-2020 07:36 AM
Formatting Nested Tables LBruce Word VBA 3 01-20-2020 09:07 AM
Removing KeepWithNext Formatting from Nested Tables? Jfedora Word VBA 3 06-06-2017 11:49 AM
Nested tables. Count rows NevilleT Word VBA 9 05-10-2017 05:22 AM
Nested vlookup with varable tables! Dave Jones Excel 0 08-30-2012 09:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:49 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