注册 登录
编程论坛 VB6论坛

find函数问题求大神解决

alexshop 发布于 2017-03-18 15:34, 784 次点击
Sub h()
   Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "["
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
    End With
    Selection.Find.Execute
End Sub

其中 .Text = "[" 这一句如果改成能搜索Text="["&number&"]"
就是搜索出“【任意整数】”就用空白代替
number这个数字可以是1000以内正整数,不知道写这个程序了。

vb中要text可以代表任意数的代码是什么??求大神指教

[此贴子已经被作者于2017-3-18 15:47编辑过]

1 回复
#2
wds12017-03-18 21:40
Sub h()
   Selection.Find.ClearFormatting
    With Selection.Find
       for i=1 to 1000
           .Text = "[" & trim(str(i)) & "]"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
       next i      
    End With
    Selection.Find.Execute
End Sub
1