这是一个老问题,你查以前的贴子,可以找到答案.
解决方案 »
- ■■■■简单的网页信息提取,网页中FLASH操作■■■■
- 我现在要从"111-1111"中取出1111111.有什么简单的方法吗?
- 如何通过热键调出隐藏的窗体?
- 数据导出,在线等待!
- Join語句
- ~ 呵呵,问个问题,basic哪里有下的,我是说那个古老的basic,不是VB,是不是很怪的问题..........
- 请介绍几本有关WIN32 SDK方面的---好书!
- 怎样锁住alt+f4键
- 两个记录集同时读了同一个表,其中一个修改了表而另一个想修改时会出错要如何解决。
- 隐藏拨号网络问题
- TreeView问题,回复的都给分!肯定给。急!昨天已经发过了,但没人回复。
- 如何制作搜索引擎,整理搜索记录呢?UP有分!!!!!!!!!!!!!!
Private Sub Form_Load()
On Error GoTo NoExl
MsgBox "处理需要一定时间,请在按“确定”后稍等。"
TePath = MainForm.Text1.Text
Set TEdata = OpenDatabase(TePath + "\LoadTemp.mdb")
Set TEreco = TEdata.OpenRecordset("zlsmall", dbOpenDynaset)
'lb2是msfelxgrid控件
LB2.Rows = 1
LB2.RowHeightMin = 270
ISPas = False
OKDO = False
OKDO = True
Dim i As Integer Dim excel_app As Object
Dim excel_sheet As Object
Dim new_value As String
Dim row As Integer DoEvents
' Create the Excel application.
Set excel_app = CreateObject("Excel.Application")
' Uncomment this line to make Excel visible.
' excel_app.Visible = True
' Open the Excel spreadsheet.
excel_app.Workbooks.Open FileName:="c:\loadme.xls"
' Check for later versions.
If Val(excel_app.Application.Version) >= 8 Then
Set excel_sheet = excel_app.ActiveSheet
Else
Set excel_sheet = excel_app
End If
' Open the Access database.
' Get data from the Excel spreadsheet and insert
' it into the TestValues table.
row = 1
Dim ii As Integer
For i = 1 To 200
' Get the next value.
LB1.AddItem " "
For ii = 1 To 12
new_value = Trim$(excel_sheet.Cells(row, ii))
LB1.TextMatrix(i, ii) = new_value
Next ii
' See if it's blank.
' Insert the value into the database.
row = row + 1
Next i
' Close the database. ' Comment the rest of the lines to keep
' Excel running so you can see it.
' Close the workbook without saving.
excel_app.ActiveWorkbook.Close False
' Close Excel.
excel_app.Quit
Set excel_sheet = Nothing
Set excel_app = Nothing
Exit Sub
NoExl:
MsgBox "对不起,无法导入Excel文件,请您确认您的电脑中已安装 Ms Office Excel 软件。"
End Sub