[求助]ActiveReport导出多个工作簿的Excel
老板公司有一套旧的软件,是VB6写的,导出(TIFF、PDF、Excel、TXT等)和打印是用Active Reports 2 写的。现在需要修改导出Excel功能,要导出到Excel的多个工作簿,网上找资料找不到啊,因此来这里求助,希望能够得到一个思路。
主要问题是怎么样才能实现多个工作簿呢?每个工作簿怎么命名? --------------------编程问答-------------------- 参考下面这个:
'引用对象库:Microsoft Excel 11.0 Object Library--------------------编程问答-------------------- 谢了。这个是直接操作Excel,与Active Reports无关了,相当于要重新来过。。不过我已经在采用这种方法试试看了,Active Reports里面多页面搞不清楚
Option Explicit
Dim xlExcel As New Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Private Sub Command1_Click()
Dim Data(1 To 200, 1 To 10) As String
Dim i As Long, j As Long
For i = 1 To 200
For j = 1 To 10
Data(i, j) = j
Next
Next
On Error GoTo Errhandler
xlExcel.Application.Visible = True
Me.MousePointer = vbHourglass
xlExcel.Workbooks.Add '创建新的excel工作薄
xlExcel.Workbooks(1).Activate
Set xlSheet = xlExcel.Workbooks(1).Worksheets(1) 'Sheet1表
xlSheet.Activate '活活Sheet1表
xlSheet.Name = "第一表" '修改Sheet1表名字
xlSheet.Columns("A:J").NumberFormatLocal = "@" '设置A-J列为文本格式。
'或者xlSheet.Range("A:J").NumberFormatLocal = "@"
xlSheet.Range("A1:J200 ") = Data '填充数组到区域A1到J200
xlSheet.Columns.EntireColumn.AutoFit '列自适应
Me.MousePointer = vbDefault
xlExcel.Workbooks(1).Sheets.Add '添加新的Sheet表
Errhandler:
Exit Sub
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
xlBook.Close
xlExcel.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlExcel = Nothing
End Sub
补充:VB , 数据库(包含打印,安装,报表)