您的位置:程序门 -> vb -> vba



怎样用vba在word里快速定位特定表格并得到这个表格的index编号


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


怎样用vba在word里快速定位特定表格并得到这个表格的index编号
发表于:2007-10-11 15:24:58 楼主
比如我word里面有100个表格,有些表格的第一个表格位置是代表编号,我用查询语句按编号找到了这个格子,但是怎么返回这个格子所在表格的是整个word的第几个表格呢?
比如这样:
        selection.find.clearformatting
        with   selection.find
                .text   =   "10"
                .replacement.text   =   ""
                .forward   =   true
                .wrap   =   wdfindcontinue
                .format   =   false
                .matchcase   =   false
                .matchwholeword   =   false
                .matchbyte   =   false
                .matchallwordforms   =   false
                .matchsoundslike   =   false
                .matchwildcards   =   false
                .matchfuzzy   =   true
        end   with
        selection.find.EXECute

找到了编号为10的表格,我怎么得到这个表格到底是word里面的第几个表格?
发表于:2007-10-11 21:59:051楼 得分:0
sub   macro1()
dim   i   as   long,   r   as   range
for   i   =   1   to   activedocument.tables.count
set   r   =   activedocument.tables(i).cell(1,   1).range
if   r.text   like   "10*"   then   msgbox   i
next
end   sub
发表于:2007-10-12 09:36:142楼 得分:0
饿。。。
我的意思是有没有什么属性能直接得到现在是第几个表格
我这样做就是想快一点,你这样循环做我会。


快速检索

最新资讯
热门点击