惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
GbyAI
GbyAI
P
Proofpoint News Feed
Microsoft Security Blog
Microsoft Security Blog
月光博客
月光博客
I
InfoQ
V
Visual Studio Blog
罗磊的独立博客
Engineering at Meta
Engineering at Meta
Vercel News
Vercel News
Jina AI
Jina AI
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
The Cloudflare Blog
小众软件
小众软件
雷峰网
雷峰网
V
V2EX
人人都是产品经理
人人都是产品经理
Stack Overflow Blog
Stack Overflow Blog

博客园 - 飞儿

要让IT收入比重越来越小 准备买房了? 想写一篇小说 如何做好测试建议清单 看新闻的时间用的太多了 robot经验整理及验证点的说明 猪肉未来还是会涨的 回归IT 2008,又是新的一年 TD各版本的汉化插件下载 QTP基础代码(转) QTP参考代码框架 自动码流转换(ROBOT) 数据库连接(ROBOT) 大小写转换(ROBOT) 行走在消逝中 写的痛快 常用ROBOT函数详解 沉下来,沉下来,别让自己太浮躁
robot取excel表格参数脚本
飞儿 · 2008-08-31 · via 博客园 - 飞儿

declare function getdata(namex as integer,namey as integer) as string
declare function setdata(resultx as integer,resulty  as integer,pa as string) as string
'$include "sqautil.sbh" '头包含

Sub Main
Dim Result As Integer
dim pass as String
dim pa as string
dim count as Integer
dim con as integer

For count=1 To 2 '在excel表里取三行数据
for con=1  to 2  '在excel表里取三列数据
'name1 = worksheet.Cells(count,1).Value '从表中取具体行列对应的值
pass=getdata(count,con)
pa=setdata(count,con+9,pass)
msgbox pass
next con
next count
End Sub
'********************以下为自定义函数****************************
function getdata(namex as integer,namey as integer)  '设置excel数据
  dim excel as Object '定义对象
  dim book as Object
  dim worksheet as Object
  dim  na as string
  on error resume next

Set excel = GetObject("excel.application") '设置excel变量为execl对象
if(excel Is Nothing) then '判断是否设置成功
Set excel = CreateObject("excel.application") '创建excel对象
if(excel Is Nothing) then '判断是否创建成功
MsgBox "Couldn't find Excel!"
End if
End if
'msgbox "成功"
Set book = excel.Workbooks.Open("d:\qin.xls") '打开具体Excel文件,这里是我d盘下一个名为qingd的xls文件
Set worksheet = book.Worksheets("1") '设置工作的表,工作表的名字为1

na=worksheet.Cells(namex,namey).Value
getdata=na
excel.Quit '关闭excel
Set excel = Nothing '把excel对象设置为空
end function


'************************************/
'/////////////////////////////
function setdata(resultx as integer,resulty as integer,pa as string)
dim excel1 as Object '定义对象
  dim book1 as Object
  dim worksheet1 as Object
  on error resume next
Set excel1 = GetObject("excel.application") '设置excel变量为execl对象
if(excel1 Is Nothing) then '判断是否设置成功
Set excel1 = CreateObject("excel.application") '创建excel对象
if(excel1 Is Nothing) then '判断是否创建成功
MsgBox "Couldn't find Excel!"
End if
End if
'msgbox "成功"
Set book1 = excel1.Workbooks.Open("d:\qin.xls") '打开具体Excel文件,这里是我d盘下一个名为qingd的xls文件
Set worksheet1 = book1.Worksheets("1") '设置工作的表,工作表的名字为1
worksheet1.Cells(resultx,resulty).Value=pa
  open "D:\2.txt" for append as #2
  write #2,pa
  excel1.Quit '关闭excel
Set excel1 = Nothing '把excel对象设置为空
end function