vvvv_vvvv 发表于 2011-1-14 10:57:16

这段代码逻辑有问题么?写入成功和失败不正确

Dim fso,filePath,i
Dim ExcelBook, ExcelSheet, myExcelBook, myExcelSheet

'保存Excel表格所放的路径
filePath="d:\login\default.xls"

'创建Excel应用程序的对象
Set fso=CreateObject("Scripting.FileSystemobject")
Set ExcelBook=Createobject("Excel.Application")
Set ExcelSheet=Createobject("Excel.Sheet")

'把Excel表中的Sheet1给一个变量
Set myExcelBook=ExcelBook.WorkBooks.open(filePath)
Set myExcelSheet=myExcelBook.worksheets("Global")

'创建一个描述性编程中的description对象,用来复习一下description的创建方法
Set myDesc = Description.Create()
IfDataTable("result", dtGlobalSheet)="√"   Then
Browser("管理系统").Page("管理系统").WebEdit("textfield").Set DataTable("name", dtGlobalSheet)
Browser("管理系统").Page("管理系统").WebEdit("textfield2").SetSecure DataTable("passwd", dtGlobalSheet)
Browser("管理系统").Page("管理系统").WebButton("登陆").Click
Browser("管理系统").Page("管理系统_2").Sync

Dim aa,b
For i=2 to 10

        b=Browser("管理系统").Page("管理系统_4").Check (CheckPoint("管理系统_3"))
        aa= Browser("管理系统").Page("管理系统_3").WebElement("用户名或密码错误,请重新输入!").Check( CheckPoint("用户名或密码错误,请重新输入!") )
                IfDataTable("name", dtGlobalSheet)="admin" Then b else aa end if
If aa or b Then        myExcelSheet.Cells(i,4).Value = "成功"        else myExcelSheet.Cells(i,4).Value = "失败"end if
Next
Browser("管理系统").Close
End If
myExcelBook.Save
ExcelBook.Quit
Set ExcelBook = Nothing

vvvv_vvvv 发表于 2011-1-14 10:58:10

:L

vvvv_vvvv 发表于 2011-1-14 11:36:28

:'(

vvvv_vvvv 发表于 2011-1-14 11:36:50

:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(: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'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'(:'

xhhuang1618 发表于 2011-1-14 12:36:05

If aa or b Then      
   myExcelSheet.Cells(i,4).Value = "成功"         
else
   myExcelSheet.Cells(i,4).Value = "失败"
end if
----根据你上面的写的程序,你aa或者b肯定是有值的,所以你excel中的结果一定的“成功”,改一下判断条件吧

vvvv_vvvv 发表于 2011-1-14 12:59:08

我这是检查点,等于的值该怎么写呢?

vvvv_vvvv 发表于 2011-1-14 14:04:50

:time:

vvvv_vvvv 发表于 2011-1-14 14:04:58

:Q

vvvv_vvvv 发表于 2011-1-14 14:09:50

:sleepy:

vvvv_vvvv 发表于 2011-1-14 14:36:01

:o
页: [1]
查看完整版本: 这段代码逻辑有问题么?写入成功和失败不正确