Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-24-2016, 10:05 PM
PRA007's Avatar
PRA007 PRA007 is offline Working with selection.tables Windows 7 64bit Working with selection.tables Office 2010 32bit
Competent Performer
Working with selection.tables
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default Working with selection.tables

Since I got nice answer at https://www.msofficeforums.com/word-...sing-word.html my life become easier. My every task is based on this template since.

Code:
Sub template()
'From https://www.msofficeforums.com/word-vba/28819-extracting-data-excel-document-using-word.html
Application.ScreenUpdating = False
Set wdDoc = ActiveDocument
With wdDoc.Range
    For Each Tbl In .Tables
        With Tbl
            For i = 1 To .Rows.Count
                With .Cell(i, 2).Range.Paragraphs(1).Range
                    With .Find
                        .ClearFormatting
                        .Replacement.ClearFormatting
                        .Text = "String"
                        .Replacement.Text = ""
                        .Forward = True
                        .Wrap = wdFindStop
                        .Format = False
                        .MatchWildcards = True
                        .Execute
                    End With
                        If .Find.Found Then
							'Do whatever you want.
                        End If
                End With
            Next
        End With
    Next
End With
End Sub
Everything is working fine with template. I made some edits from the answer to make it clear. Now the problem is I tried my best to make the template that is doing exactly similar what above is doing except not for every table but for selected table. (Table no. is not fixed so table with cursor). I tried modifying for each tbl to selection.tables but as you no is not that easy. What is the right way to do that?
Reply With Quote
 

Tags
word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with selection.tables Working with Selection.range. PRA007 Word VBA 2 02-19-2016 12:52 AM
Working with selection.tables Working with word tables. PRA007 Word VBA 1 12-02-2015 04:22 AM
Working with selection.tables Header Rows in Tables Not Working Andy Pilkington Word 2 10-10-2014 12:36 AM
Working with selection.tables Selection.EndKey not working in 2010 Smallweed Word VBA 4 08-19-2014 07:21 AM
Working with selection.tables working with excel tables in MS word radman154 Word Tables 1 03-25-2011 12:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:39 AM.


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