📄 www1.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form2
Caption = "MAC设置"
ClientHeight = 4095
ClientLeft = 4005
ClientTop = 2925
ClientWidth = 7545
KeyPreview = -1 'True
LinkTopic = "Form2"
MDIChild = -1 'True
ScaleHeight = 4095
ScaleMode = 0 'User
ScaleWidth = 6471.716
WindowState = 2 'Maximized
Begin VB.CommandButton Command3
Caption = "存xls"
Height = 495
Left = 5280
TabIndex = 2
Top = 3480
Width = 855
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 600
Top = 3480
Width = 2055
_ExtentX = 3625
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=www.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=www.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "www"
Caption = "上 下"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "www1.frx":0000
Height = 3375
Left = 0
TabIndex = 3
Top = 0
Width = 7575
_ExtentX = 13361
_ExtentY = 5953
_Version = 393216
DefColWidth = 53
ColumnHeaders = -1 'True
HeadLines = 1
RowHeight = 15
RowDividerStyle = 1
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "返回"
Height = 495
Left = 6360
TabIndex = 4
Top = 3480
Width = 855
End
Begin VB.CommandButton Command4
Caption = "删除"
Height = 495
Left = 4200
TabIndex = 1
Top = 3480
Width = 855
End
Begin VB.CommandButton Command2
Caption = "刷新"
Height = 495
Left = 3120
TabIndex = 0
Top = 3480
Width = 855
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Dim oleExcel As Object
Dim k, l As Integer
Private Sub Command1_Click()
Form1.Show
Form1.Enabled = True
Form2.Hide
End Sub
Private Sub Command2_Click() '刷新
Adodc1.Refresh
End Sub
Private Sub Command3_Click() '存xls
Dim i, j, z, zsl As Integer, s As String
z = MsgBox("覆盖数据,否另存为?", 3 + 256 + 4096, "提示")
' If i = 2 Then Exit Sub
If z = 2 Then
Exit Sub
ElseIf z = 7 Then
s = InputBox("输入文件名", "提示")
If s = "" Then Exit Sub
End If
Adodc1.Refresh
zsl = Adodc1.Recordset.RecordCount
' Print zsl
Set oleExcel = CreateObject("Excel.Application")
oleExcel.Visible = False
oleExcel.WindowState = 1
' 打开文件
oleExcel.Workbooks.Open FileName:=App.Path & "\readonly.xls"
'ActiveWorkbook.PrintOut
'oleExcel.Workbooks.Add
' 从xls文件中读内容
'Label1.Caption = oleExcel.Worksheets("Memory_map").Range("f90").Cells(1, 1)
' 写内容到xls文件中
For i = 1 To zsl - 1
Adodc1.Recordset.MoveNext
oleExcel.Worksheets("sheet1").Cells(i, 1) = Adodc1.Recordset(48)
For j = 0 To 47
oleExcel.Worksheets("sheet1").Cells(i, j + 2) = Adodc1.Recordset(j)
Next j
Next i
' For i = zsl To 50
' For j = 1 To 49
' oleExcel.Worksheets("sheet1").Cells(i, j) = " "
' Next j
' Next i
If z = 6 Then
oleExcel.ActiveWorkbook.Save
ElseIf z = 7 Then
oleExcel.ActiveWorkbook.Saveas App.Path & "\" & s
End If
oleExcel.ActiveWorkbook.Close
oleExcel.Quit
End Sub
Private Sub Command4_Click() '删除
Dim i As Integer
i = MsgBox("确认删除?", 1 + 256 + 4096, "提示")
If i = 2 Then Exit Sub
Adodc1.Recordset.Delete
End Sub
Private Sub adodc1_Validate(Action As Integer, Save As Integer)
Dim i As Integer
Command4.Enabled = True
End Sub
Private Sub Form_Load()
' Set oleExcel = CreateObject("Excel.Application")
' oleExcel.Visible = True
' oleExcel.WindowState = 1
' oleExcel.Workbooks.Open FileName:=App.Path & "\readonly.xls"
Adodc1.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form1.Show
Form1.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -