Microsoft Office Forums Word VBA_find string against bullet point

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 01-12-2018, 09:07 AM
Mahesh Mahesh is offline Word VBA_find string against bullet point Windows 10 Word VBA_find string against bullet point Office 2007
Novice
Word VBA_find string against bullet point
 
Join Date: Jan 2018
Posts: 1
Mahesh is on a distinguished road
Default

I have table (Row:10, column:2) in word document, 2nd column of row 10, contain text with bullet points,
again under some bullet point there is multilevel lists as mentioned below.

Steps
1.create new excel document (wb2)
2. Go back to main word file (wb1) with table (Row:10,Col:2)
3. Pop Up InputBox, user will input search string "ABC"
4.search text "ABC" against bullet point if found copy on (wb2- column A)
5. If again there is multilevel list under bullet point
6. search "USD" if found copy USD amount to (wb2 - column B)
7. search "Location" if found Location to (wb2 - column C)

College ABC JJJJ
College XYZ JJJJ
(i) Debit USD 1000 for ZZZ
(ii) Debit USD 56 for MNN
(iii) Location - USA
College NNN JJJJ

i will appreciate any help on this.

I do post here also.
https://www.excelforum.com/word-form...ml#post4815387
http://www.excelfox.com/forum/showth...t-bullet-point

I will appreciate any assistance to edit below code;
Code:
Sub test()
Dim TargetText As String, StrMsg As String
Dim Col As Long, i As Long, j As Long, Rng As Range
With Selection
  If .Information(wdWithInTable) = False Then
    MsgBox "The cursor must be within a table cell.", , "Cursor outside table"
    Exit Sub
  Else
    Col = .Cells(1).ColumnIndex
    TargetText = InputBox("Enter text to search. " & _
      "This macro will search the column you have " & _
      "selected for this text and count how many " & _
      "times it appears in that column. Do you want to continue?", _
      "Enter text to find and count")
    With .Tables(1)
      For i = 1 To .Rows.Count
        Set Rng = .Cell(i, Col).Range
        With .Cell(i, Col).Range
     
         With .Find
            .ClearFormatting
            .Text = TargetText
            '.Replacement.ClearFormatting ''Clear existing formatting and settings in Find feature.
            .Replacement.Highlight = True 'Set highlight to replace setting.
            .Replacement.Text = ""
            '.Replacement.
            .Forward = True
            .Wrap = wdFindStop
            .Format = True
            .MatchCase = False
            .MatchWholeWord = True
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
            .Execute Replace:=wdReplaceAll
          End With

          Do While .Find.Found
            If .Duplicate.InRange(Rng) Then
              j = j + 1
              .Collapse wdCollapseEnd
              .Find.Execute
            Else
              Exit Do
            End If
          Loop
        End With
      Next
    End With
    Select Case j
      Case 0: StrMsg = "The text " & TargetText & " was not found in the selected column "
      Case 1: StrMsg = "There is 1 occurrence of the text " & TargetText & " in the selected column "
      Case Else: StrMsg = "There are " & j & " occurrences of the text '" & TargetText & "' in the selected column "
    End Select
    MsgBox StrMsg & Col & ".", , "Text search in column"
  End If
End With
End Sub

  #2  
Old 01-12-2018, 12:47 PM
macropod's Avatar
macropod macropod is offline Word VBA_find string against bullet point Windows 7 64bit Word VBA_find string against bullet point Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,655
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You have not complied with the cross-post rules at Excelforum and you have failed to notify Excelfox of your cross-posts either here or at Excelforum . Kindly do so.

Update: You have also cross-posted at VBA Express. Kindly read and comply with the forum rules of all of the forums on which you have cross-posted about this.

No support will be provided until you have complied.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
  #3  
Old 01-19-2018, 03:27 AM
macropod's Avatar
macropod macropod is offline Word VBA_find string against bullet point Windows 7 64bit Word VBA_find string against bullet point Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,655
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Since you have cross-posted this on multiple other forums as well without providing the expected cross-post links. This thread is now closed.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuing bullet point numbers Se7encm PowerPoint 0 03-12-2017 02:57 AM
Can I use the first letter of each of my sentences to create a bullet point? newbuilder PowerPoint 2 04-08-2016 12:43 PM
Word VBA_find string against bullet point Adding spaces only between each main bullet point dylansmith Word 2 09-02-2015 05:14 AM
Can i align text so it starts before a bullet point? at11 Word 1 03-20-2015 09:12 AM
Word VBA_find string against bullet point Last bullet point does not display with animation leenhout PowerPoint 1 05-16-2012 10:25 AM


All times are GMT -7. The time now is 12:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft