求助高手,写了一个代理,统计并输出数据到excel中,手工运行代理,输出数据成功;自动运行代理则不输出excel。
求助高手,写了一个代理,统计并输出数据到excel中,手工运行代理,输出数据成功;自动运行代理则不输出excel。Sub Initialize
'------------------------------------------------------
'function: this agent run once a day,in orde to export data to TS2
'------------------------------------------------------
On Error Goto catch
Dim session As New NotesSession
Dim db As notesdatabase
Set db = session.CurrentDatabase
Dim pro As NotesDocument
Set pro = db.GetProfileDocument("Profile")
If pro.days(0) = "2" Or pro.days(0)="1" Then
Exit Sub
End If
Dim location As String
Dim userName As String
Dim passWord As String
location = pro.Location(0)
userName = pro.UserName(0)
passWord = pro.PassWord(0)
Dim yy As Variant
yy = Split(pro.Location(0),"\")
If Not pro.UserName(0) = "" Then
Dim strCom As String
Dim result As Integer
strCom = "net use \\"+yy(2)+" "+passWord+" /user:"+userName
result = Shell(strCom,1)
End If
Call RealtimeExport(location,pro)
Call statisticExport(location,pro)
Exit Sub
catch:
Print "export: ln_"&Erl()&" "&Error()&" "
Exit Sub
End Sub
请高手给予帮助!谢谢! --------------------编程问答-------------------- 补充:这个代理是运行在一个Domino服务器上的,统计这个服务器上DB的信息,并以Excel的形式输出到另一个机器上。请高手指点! --------------------编程问答-------------------- 再次请求高手帮助! --------------------编程问答-------------------- Call RealtimeExport(location,pro)
Call statisticExport(location,pro)
这两个函数都是干嘛的啊?
是调用操作系统的excel控件创建excel文档吗?
如果是,那么手动运行的时候是调动当前机器的excel控件,自动运行的时候调用Domino服务器的excel控件,所以,自动运行的时候需要确认Domino服务器安装了excel。。
如果不是上面说的原因。。就不好说了。不清楚你这两个函数怎么写的啊?
--------------------编程问答-------------------- 向“ppmmjjyy”致谢!
Call RealtimeExport(location,pro)
Call statisticExport(location,pro)
这两个函数确实是调用操作系统的excel控件创建excel文档
Sub statisticExport(directory As String,NewDoc As NotesDocument)
'----------------------------------------------------------
'export file "RatioinDept" "Ratioindetails" "RatioinMachineType"
'----------------------------------------------------------
Dim session As New NotesSession
Dim db As notesdatabase
Set db = session.CurrentDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim pro As NotesDocument
Set pro = db.GetProfileDocument("Profile")
Dim docs As NotesDocumentCollection
Dim currentDoc As NotesDocument
Dim dept() As String
Dim i As Integer
Dim location As String
Dim table6(0 To 1) As String
location = directory
Set currentDoc = NewDoc
Dim view6 As NotesView
Set view6 = db.GetView("MachineCountViewForTS2")
Dim doc6 As NotesDocument
Set doc6 = view6.GetFirstDocument
Dim departmentIndex(0 To 10) As Integer
'Dim depart(0 To 10) As String
fileName6 = location+"Ratioindetails"+Format(Today,"yyyy-mm-dd")+".csv"
exportfile6 = fileName6
Dim export6 As Integer
export6 = Freefile
Open exportfile6 For Output As export6
。。。。。。。。。 --------------------编程问答-------------------- 手动执行的时候是调用你本机的环境,自动运行的时候是调用服务器上的环境。检查一下你服务器上的环境。比如生成Excel,你的服务器上应当有Excel才行呀。 --------------------编程问答-------------------- 你的服务器里必须安装Excel才行。 --------------------编程问答-------------------- 你还需要考虑权限的问题,在服务器自动运行是以代理的最后修改者身份运行,手动运行是以运行者的身份运行 --------------------编程问答-------------------- 學習,支持. --------------------编程问答-------------------- mark... --------------------编程问答-------------------- 你要看你服务器上有没有excel环境啊,手动运行是本机的,自动运行是在服务器上,别忘了管理员签名 --------------------编程问答-------------------- 应该是BS的吧。
所有代理是运行在服务上面的。 --------------------编程问答-------------------- 要保证你的服务器系统是windows的才行,在windows下的写法和unix下是不一样的 --------------------编程问答-------------------- 服务器上需excel环境 --------------------编程问答-------------------- 了解
补充:企业软件 , Lotus