壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1762|回复: 1

在B/S结构下,如何将视图的数据导入到excel中

[复制链接]
发表于 2005/3/2 11:56:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
请问各位高手,如何将视图的数据导入到excel中?基于B/S结构的。
能不能将源代码写给我?真的谢谢了
发表于 2005/4/5 11:42:48 | 显示全部楼层
Sub Click(Source As Button)
Print "Please Wait.....Running MSExcel report"
Dim session As New NotesSession
Dim doc As Notesdocument. Dim doc2 As Notesdocument. Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Dim handle As Variant
Dim db As NotesDatabase
Dim view As NotesView
Dim counter As Integer
counter3 = 0
counter4 = 0
counter5 = 0
counter6 = 0
counter7 = 0
yescounter3 = 0
yescounter4 = 0
yescounter5 = 0
yescounter6 = 0
yescounter7 = 0
Set db = session.CurrentDatabase
Set view = db.GetView( "StateReport" )
Set doc2 = view.GetFirstdocument.nbsp
' Forall c In view.Columns
' Messagebox( c.Position & " " & c.Title )
' End Forall
Columnname3 =view.Columns(3).Title
Columnname4 =view.Columns(4).Title
Columnname5 =view.Columns(5).Title
Columnname6 =view.Columns(6).Title
Columnname7 =view.Columns(7).Title
While Not ( doc2 Is Nothing )
vtitle5 = doc2.Columnvalues( 3 )
vNSR = doc2.Columnvalues( 4 )
vPSD = doc2.Columnvalues( 5 )
vUtil = doc2.Columnvalues( 6 )
vTier2 = doc2.Columnvalues( 7 )
If vtitle5 = "No" Then
counter3 = counter3 + 1
Else
If vtitle5 = "Yes" Then
yescounter3 = yescounter3 + 1
End If
End If
If vNSR = "No" Then
counter4 = counter4 + 1
Else
If vNSR = "Yes" Then
yescounter4 = yescounter4 + 1
End If
End If
If vPSD = "No" Then
counter5 = counter5 + 1
Else
If vPSD = "Yes" Then
yescounter5 = yescounter5 + 1
End If
End If
If vUtil = "No" Then
counter6 = counter6 + 1
Else
If vUtil = "Yes" Then
yescounter6 = yescounter6 + 1
End If
End If
If vTier2 = "No" Then
counter7 = counter7 + 1
Else
If vTier2 = "Yes" Then
yescounter7 = yescounter7 + 1
End If
End If
Set doc2 = view.GetNextdocument. doc2 )
Wend
Set doc = New Notesdocument. session.CurrentDatabase )
Set rtitem = New NotesRichTextItem( doc, "Body" )
Set object = rtitem.EmbedObject _
( EMBED_OBJECT, "Microsoft Excel Worksheet", "", _
"Report" )
Set handle = object.Activate( True )
handle.Application.Cells( 1,2).value = Columnname3
handle.Application.Cells( 1,3).value = Columnname4
handle.Application.Cells( 1,4).value = Columnname5
handle.Application.Cells( 1,5).value = Columnname6
handle.Application.Cells( 1,6).value = Columnname7
handle.Application.Cells( 2,1).value = "Yes"
handle.Application.Cells( 2,2).value = yescounter3
handle.Application.Cells( 2,3).value = yescounter4
handle.Application.Cells( 2,4).value = yescounter5
handle.Application.Cells( 2,5).value = yescounter6
handle.Application.Cells( 2,6).value = yescounter7
handle.Application.Cells( 3,1).value = "No"
handle.Application.Cells( 3,2).value = counter3
handle.Application.Cells( 3,3).value = counter4
handle.Application.Cells( 3,4).value = counter5
handle.Application.Cells( 3,5).value = counter6
handle.Application.Cells( 3,6).value = counter7
handle.Application.Worksheets.Copy
' handle.Parent.Save
' If ( handle Is Nothing ) Then
' doc.Subject = "This object has no OLE automation interface"
' Else
' doc.Subject = "This object has an OLE automation interface"
' End If
' Call doc.Save( True, True )
Print "Done"
Print " "
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/30 02:31 , Processed in 0.015827 second(s), 16 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表