troubleshooting Question

MS Word.  Capture All Of the Data in A Table Cell

Avatar of WonHop
WonHopFlag for United States of America asked on
VBAMicrosoft Word
2 Comments1 Solution135 ViewsLast Modified:
Hello All.  I have the code below that irudyk helped me with.  It works great.  It looks for "TBD" .  If they are in a Table, it gets the Section Number and the Title of the Table.
I need another piece of code to capture all of the data in the cell with the TBD.  The cell might have "TBD <5.1>" with other text..  I need to capture all of that data in a variable.
I am running this code out of MS Access.
Please see attached file.

Dim FindRange As Word.Range
Set FindRange = ActiveDocument.Range

FindRange ' TBD"
Do While FindRange.Find.Execute() = True
        pdPage = FindRange.Information(wdActiveEndPageNumber)
        Selection.Goto wdGoToPage, wdGoToAbsolute, pdPage
        pageNumberText = FindRange.Sections(1).Footers(WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Text

        If FindRange.Information(Word.WdInformation.wdWithInTable) = True Then

            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            strCaptureAllDataInTableCell = I need to capture all if the data in the cell once the TBD is found.
            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
           
            strColumn = FindRange.Information(wdStartOfRangeColumnNumber)
            strRow = FindRange.Information(wdStartOfRangeRowNumber)
            strSectionNumberText = Trim(Selection.Range.ListFormat.ListString) & " " & Selection.Paragraphs(1).Range.Text
            FindRange.Tables(1).Cell(1, 1).Select
            Selection.Previous(wdParagraph, 1).Select
            Selection.MoveLeft wdCharacter, 1, wdExtend
            strTableTitle = Selection.Text
        End If
Loop

Thanks
WonHop
EE_Sample_01.docx
ASKER CERTIFIED SOLUTION
GrahamSkan
Retired
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros