?
Solved

Nested Table In Word

Posted on 2003-03-12
10
Medium Priority
?
292 Views
Last Modified: 2010-05-01
Hello,
How can i know that word document contains nested table.This document must be created in word2000 as word97 does't suport this property.But my problem is i am opening document in word97.Word97 converts nested table to simple text,which destroy the formating.
I tried with
/*aa=objword.ActiveDocument.Tables(1).Table.Count
  if aa>0 then msgbox "Nested Table Found"   */
With object of word2000 it works perfect.
In 97 error is, object does't support this property (........coz there is no nested table.)
Any alternate to know about nested table in document
0
Comment
Question by:my_vicku
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 9

Accepted Solution

by:
dmang earned 100 total points
ID: 8121170
   

Dim w As Integer, c As Integer, r As Integer
    dim blnHasNestedTables as boolean
    With ActiveDocument
       
      For w = 1 To .Tables.Count
        For c = 1 To .Tables(w).Columns.Count
          For r = 1 To .Tables(w).Rows.Count
            If .Tables(w).Cell(r, c).Tables.Count > 0 Then
                blnHasNestedTables = true  
             End If
          Next r
        Next c
     Next w
   
    End With

    if blnHasNestedTables = true then
        msgbox "Document contains nested tables"
    end if

End Sub
0
 
LVL 9

Expert Comment

by:dmang
ID: 8121171
   

Dim w As Integer, c As Integer, r As Integer
    dim blnHasNestedTables as boolean
    With ActiveDocument
       
      For w = 1 To .Tables.Count
        For c = 1 To .Tables(w).Columns.Count
          For r = 1 To .Tables(w).Rows.Count
            If .Tables(w).Cell(r, c).Tables.Count > 0 Then
                blnHasNestedTables = true  
             End If
          Next r
        Next c
     Next w
   
    End With

    if blnHasNestedTables = true then
        msgbox "Document contains nested tables"
    end if

End Sub
0
 
LVL 9

Expert Comment

by:dmang
ID: 8121172
   

Dim w As Integer, c As Integer, r As Integer
    dim blnHasNestedTables as boolean
    With ActiveDocument
       
      For w = 1 To .Tables.Count
        For c = 1 To .Tables(w).Columns.Count
          For r = 1 To .Tables(w).Rows.Count
            If .Tables(w).Cell(r, c).Tables.Count > 0 Then
                blnHasNestedTables = true  
             End If
          Next r
        Next c
     Next w
   
    End With

    if blnHasNestedTables = true then
        msgbox "Document contains nested tables"
    end if

End Sub
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Expert Comment

by:dmang
ID: 8121184
HI .. sorry about the duplicates... this submit button has focus too often.
Anyway .. the code supplied will identify nested tables. Put this is the document "close" event.

0
 

Assisted Solution

by:vikram_munjal
vikram_munjal earned 100 total points
ID: 8125201
Anothere thing if you open document in word 97 which does't support nested table converts nested tables to text.So every time there will be no nested table in that document.Am i right?


0
 

Author Comment

by:my_vicku
ID: 8125207
HI Again,
Thanks for your support but unfortunately there is some problem with it
<code>
If .Tables(w).Cell(r, c).Tables.Count > 0 Then
</code>
here cell(r,c).Tables does't work
compiler error message is Method or datamember not found.
Anothere thing is if i open document in word 97 which does't support nested table converts nested tables to text.So every time there will be no nested table in that document.
0
 
LVL 9

Expert Comment

by:dmang
ID: 8135906
Here's an alternative...

First make the close code conditional on being at least word version 9..

When you are closing the document in word2000, use the code above to check for nested tables.  If found, select the cell contents and cut the table from the particular cell.  (Keep track of the table number, column, and row)

go to the end of the document
Create three blank lines (vbcrlf & vbcrlf)
Create a bookmark.
Move up 3 lines, and add a suitable identifier for the table
movedown 1 line
Paste the table
Select the original table cell, and create a hyperlink to the bookmark, with suitable text (ie. "Cell content found here"

 
0
 

Expert Comment

by:CleanupPing
ID: 9056406
my_vicku:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9664487
Moderator, my recommended disposition is:

    Split points between: dmang and vikram_munjal

DanRollins -- EE database cleanup volunteer
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question