一个程序出错的问题
tob 2008-04-19 11:47:27 我之前没有用过vb,觉得语法挺怪的,但要实现一个功能,我在网上找了一个代码,但运行出错
Dim wa As Object
i = 1
Set wa = CreateObject("word.application")
wa.Visible = True
wa.Documents.Open FileName:="c:\test.doc"
taga:
wa.Selection.MoveDown Unit:=wdLine, Count:=l + 1
wa.Selection.HomeKey Unit:=wdLine ', Extend:=wdExtend
wa.Selection.EndKey Unit:=wdStory, Extend:=wdExtend
If wa.Selection.Words.Count > 1 Then
wa.Selection.Cut
wa.ActiveDocument.SaveAs FileName:="C:\" & i & ".doc"
i = i + 1
wa.Selection.PasteAndFormat (wdPasteDefault)
wa.Selection.HomeKey Unit:=wdStory
wa.Selection.MoveDown Unit:=wdLine, Count:=l - 1, Extend:=wdExtend
wa.Selection.EndKey Unit:=wdLine, Extend:=wdExtend
wa.Selection.Delete Unit:=wdCharacter, Count:=1
wa.Selection.HomeKey Unit:=wdStory
GoTo taga
Else
wa.ActiveDocument.SaveAs FileName:="C:\" & i & ".doc"
j = i
End If
wa.Documents.Close
是运行到 wa.Selection.MoveDown Unit:=wdLine, Count:=l + 1 里面出错,怎么回事呢?
别人程序的贴子是 http://topic.csdn.net/t/20030424/14/1702820.html