简体   繁体   中英

How to identify the third column of the third table for MS Word macro

I am trying to figure out if I can set the range of a range variable in MS Word VB for applications to the third column of the third table in a MS Word document.

So far, this is as close as I can get without my code breaking:

Set range = ActiveDocument.Tables(3).range

Is there any way for me to put in a reference to Columns(3) in there without the debugger going crazy?

My code so far:

Set range = ActiveDocument.Tables(3).range
With range.Find
    .Text = "Passed"
    .Format = True 
    .MatchCase = True
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    Do While .Execute(Forward:=True) = True
        iCount = iCount + 1
    Loop
End With

Something like ... ?

Dim col As Column
Set col = ActiveDocument.Tables(3).Columns(3)
col.Cells(1).Range.Text = "Abc"
Debug.Print col.Cells(1).Range.Text

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM