以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  执行 Word vba 代码  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=185561)

--  作者:tld
--  发布时间:2023/3/2 8:43:00
--  执行 Word vba 代码
老师好。下面Word vba 代码如何才能转化到foxtable的一个按钮中?谢谢!  
(Word模板。docx中的[编号],用123456替换。
    Windows("Word模板.docx").Activate
    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
        ActiveWindow.Panes(2).Close
    End If
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow._
        ActivePane.View.Type = wdOutlineView Then
        ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "[编号]"
        .Replacement.Text = "123456"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

--  作者:有点蓝
--  发布时间:2023/3/2 8:55:00
--  
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=185341&replyID=215037&skin=1