james.zhong 发表于 2007-10-29 12:47:43

绝对支持!!沙发~~~~~太牛了!慢慢消化中。。。。

AJMIAO 发表于 2007-12-20 16:28:30

好贴留名。学习。

arlenexhl 发表于 2008-5-21 14:41:44

辛苦了!谢谢!;P 有图片就更好了

guojunlin 发表于 2008-6-20 09:39:55

刚开始学习收藏一下

witt 发表于 2008-7-7 15:54:55

好好好

tt2008 发表于 2008-8-2 00:23:17

hhhhhhhhhhhhhhh

misslu 发表于 2008-8-19 14:16:36

anyway,thanks for your share.:handshake

ttyttt 发表于 2008-11-4 11:10:07

robot取excel表格参数脚本,并把结果写入excel,其中还包含结果判断

http://www.cnblogs.com/ttyttt/archive/2008/08/31/1280812.html
robot取excel表格参数脚本
declare function getdata(namex as integer,namey as integer) as string
declare function setdata(resultx as integer,resultyas 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=1to 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
dimna 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


posted on 2008-08-31 23:35 飞儿 阅读(29) 评论(0)编辑 收藏 网摘

yarmouthlee 发表于 2011-3-5 13:43:06

很好。收藏了

村上舞!舞!舞 发表于 2011-8-15 16:16:42

很早的贴子了,偶尔还会被翻出来。现在学习这个的人可不多了
页: 1 2 [3]
查看完整版本: robot函数实例讲解