[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Detect first one-row-table in document and display the index number in a msgbox

Posted on 2014-04-03
2
Medium Priority
?
259 Views
Last Modified: 2014-04-04
Dear Experts:

I would like to run a macro with the following requirements:

Search for the first one-row table in the current document and if found display the index number in a msgbox.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
[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
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 39974401
Hi Andreas,
 I'm sure that you could do this yourself, but see if this does it:
Sub FirstSingle()
    Dim tbl As Table
    Dim i As Integer
    
    For Each tbl In ActiveDocument.Tables
        i = i + 1
        If tbl.Rows.Count = 1 Then
            MsgBox "First single-row table is No: " & i
            Exit For
        End If
    Next tbl
End Sub

Open in new window

0
 

Author Closing Comment

by:AndreasHermle
ID: 39978055
thank you very much for your great help. I do quite a lot of code writing myself by mostly tweaking your codes but sometimes I got stuck with even the easiest things.

Regards, Andreas
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
Suggested Courses

656 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