|
调用以下程序的时候,QTP报错““aRange11=aRange1.Range(0,2)”不是同一对象集”,请高手指点,怎么改正呢?急盼
Function list2(arg4,arg5)
Dim wApp,file1,file2
Set WApp=CreateObject("Word.Application")
wApp.visible = false '将程序隐藏
Set file1=wApp.documents.open( arg4 )
Set file2=wApp.documents.open( arg5 )
n1=file1.Paragraphs.Count
n2=file2.Paragraphs.Count
If n1<>n2 Then
msgbox "两文档段落数不同,无需对比"
else
For n=1 to n1
Dim aRange1,aRange2,ss
ss=";"
Set aRange1= file1.Paragraphs(n)
Set aRange11=aRange1.Range(0,2)
Set aRange2= file2.Paragraphs(n)
Set aRange22=aRange2.Range(0,2)
tmp1=aRange11.Words
tmp2=aRange22.Words
If StrComp ( tmp1, tmp2 ,0) <> 0 then
ss=ss+tmp2
End If
Next
End If
wApp.Quit
End Function |
|