📄 frmdaoru.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmdaoru
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 6390
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 6390
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "Command3"
Height = 495
Left = 2640
TabIndex = 4
Top = 2280
Width = 1575
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1560
Top = 2400
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "Command2"
Height = 375
Left = 4080
TabIndex = 3
Top = 1440
Width = 1455
End
Begin VB.TextBox txtAccessFile
Height = 375
Left = 1080
TabIndex = 2
Text = "Text2"
Top = 1440
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 4080
TabIndex = 1
Top = 480
Width = 1335
End
Begin VB.TextBox txtExcelFile
Height = 495
Left = 1080
TabIndex = 0
Text = "Text1"
Top = 480
Width = 2535
End
End
Attribute VB_Name = "frmdaoru"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
CommonDialog1.ShowOpen
txtExcelFile.Text = CommonDialog1.FileName
End Sub
Private Sub Command3_Click()
Call zdf
Dim excel_app As Object
Dim excel_sheet As Object
Dim new_value As String
Dim row As Integer
Screen.MousePointer = vbHourglass
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:=txtExcelFile.Text
' 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
rs.Open "select * from info", conn, adOpenStatic, adLockOptimistic
row = 1
Do
conn.Execute "insert into info values(" & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & "," & excel_sheet.Cells(row, 1) & ")"
row = row + 1
Loop
Set conn = Nothing
excel_app.ActiveWorkbook.Close False
' Close Excel.
excel_app.Quit
Set excel_sheet = Nothing
Set excel_app = Nothing
Screen.MousePointer = vbDefault
MsgBox "Copied " & Format$(row - 1) & " values."
End Sub
Private Sub Form_Load()
Dim file_path As String
file_path = App.Path
If Right$(file_path, 1) <> "\" Then file_path = file_path & "\"
txtAccessFile.Text = file_path & "db1.mdb"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -