请教字符串变量的操作
如题,请教一下字符串变量的相加操作。进入ExpertView,录制代码如下:
Browser("MERCHANT web site simulator").Page("MERCHANT web site simulator").WebEdit("customerid").Set "66"
Browser("MERCHANT web site simulator").Page("MERCHANT web site simulator").WebEdit("customfield").Set "Account with customer id 66"
提取字符串变量,改脚本如下:
CustomerAccount = 66
CustomerField = "Account with customer id" +CustomerAccount
Browser("MERCHANT web site simulator").Page("MERCHANT web site simulator").WebEdit("customerid").Set CustomerAccount
Browser("MERCHANT web site simulator").Page("MERCHANT web site simulator").WebEdit("customfield1").Set CustomerField
运行后,显示CustomerField = "Account with customer id" +CustomerAccount 这句语法出错。
这里请问大家该如何操作字符串的相加,非常感谢!:) 楼主在定义CustomerAccount 的时候
CustomerAccount = 66
这样CustomerAccount 就是INT型,
应该改为
CustomerAccount = "66"
CustomerField = "Account with customer id " +CustomerAccount
这样就可以了. CustomerField = "Account with customer id " & CustomerAccount +和&是一样的功能! & 和 + 都试过啦,下面这个例子,运行时:
cardnum = "4520340000466238"
customerfield 2 = "the customer with the visa card named " + cardnum
同样报错,如附图所示。疑惑中 cardnum = "4520340000466238"
customerfield = "the customer with the visa card named " + cardnum
msgbox customerfield
自己看吧 customerfield 2 变量中间还可以有空格的? 楼上说的对,1、"66"和66,类型要注意。2、customerfield2和customerfield 2不一样,后者不正确。
谢谢大家都帮助,:)
页:
[1]