Page 3 of 3 FirstFirst 1 2 3
Results 41 to 42 of 42

Thread: [VBA Excel] To find word in Microsoft Word Table and copy Offsets to Excel Cells

  1. #41
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Jul 2008
    That's really quite simple. You should spend a little time studying Word's API.
    Paul Edstein
    [Fmr MS MVP - Word]

  2. #42
    I was thinking of using
    , but it's currently using With .Find

    Trying to make it look for Exact Word, if there are multiple similar words like :Apple, apple, Red Apple, red apple, I want it to make the SearchWord = "Apple" and get only that one for example. I think that would be called to find the Exact Match

    This would take more time, so it's not viable, have to try with the .Find function for the Exact match
    If InStr(TblCell.Range, SearchWord) Then
    Did as below, find the MatchCase as Apple, but it doesen't go to the last result, it stops to the 1st encountered one, any idea how this can be done such as reaching the last found result? I've tried .Forward = True
     Dim SearchWord As String
    SearchWord = "Apple"
              For Each wdTbl In .Tables
                With wdTbl.Range
                 With .Find
                    .Text = SearchWord
                    .MatchCase = True
                    .MatchWholeWord = True
                     .Forward = True
                    .Wrap = wdFindStop
                  End With
                  If .Find.Found = True Then
                    WkSht.Range("A" & 1).Value = Split(wdTbl.Cell(.Cells(1).RowIndex, .Cells(1).ColumnIndex+1).Range.Text, vbCr)(0)
                    Exit For
                  End If
                End With
    Last edited by johngalvin; 09-30-2019 at 05:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts