以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]代码在word2016能行,但在2007不行  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=142601)

--  作者:JN_LC
--  发布时间:2019/11/1 9:00:00
--  [求助]代码在word2016能行,但在2007不行

我有段代码在装有word2016的机器上能运行,但在装有word2007的机器上不能运行.代码如下,请指教!

Dim app As New MSWord.Application

 

app.Selection.HomeKey (Unit:=6)
Dim unitsMoved As Short
Do
    unitsMoved = app.Selection.MoveDown(Unit:=4, Count:=5, Extend:=1)
    If unitsMoved = 5 And app.ActiveDocument.Range(0, app.Selection.End).Paragraphs.Count <> app.ActiveDocument.Paragraphs.Count Then
        app.Selection.InsertAfter (vbCrLf)
    End If
Loop Until unitsMoved < 5

 

app.Selection.WholeStory
app.Selection.Font.Size = 12

app.Selection.Range.ListFormat.ApplyListTemplateWithLevel (ListTemplate:=app.ListGalleries(2).ListTemplates(2), ContinuePreviousList:=False, ApplyTo:=0, DefaultListBehavior:=2)

[此贴子已经被作者于2019/11/1 10:52:10编辑过]

--  作者:有点蓝
--  发布时间:2019/11/1 9:39:00
--  
卸载重新安装完整版的2007。一般ghost系统自带的都是简易版,绿色版