Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Nested Table In Word

Posted on 2003-03-12
10
Medium Priority
?
301 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
9 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

564 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