发表于:2004/7/22 13:27:00
#0楼
随便遍遍,请别见笑,请多提意见。
模块代码
Sub auto_open()
UserForm1.IeTimer1.Enabled = ValFalse
UserForm1.IeTimer1.Interval = 5000
UserForm1.Show
Application.OnUndo "Undo VB Procedure", "auto_open"
End Sub
Public j As Integer
采集窗体代码
Private Sub IeTimer1_Timer()
j = j + 1
Sheet1.Cells(2, 3).Value = j
Sheet1.Cells(j + 1, 1).Value = j
Sheet1.Cells(j + 1, 2).Value = j + 1 ''写采样值应为串口值MSComm1.Input
End Sub
Private Sub readdata_Click()
IeTimer1.Enabled = ValTrue
End Sub
Private Sub tingzhidu_Click()
IeTimer1.Enabled = ValFalse
End Sub
Private Sub tuichu_Click()
Sheet1.Protect ([711001])
End
End Sub
Private Sub UserForm_Activate()
Sheet1.Unprotect ([711001])
Sheet1.Cells(1, 1).Value = "序号"
Sheet1.Cells(1, 2).Value = "测量值"
Sheet1.Cells(1, 3).Value = "测量个数"
IeTimer1.Enabled = ValFalse
Sheet1.Activate
j = Sheet1.Cells(2, 3).Value
End Sub
Private Sub xtchushi_Click()
Dim i, k As Integer
IeTimer1.Enabled = ValFalse
Sheet1.Cells(2, 3).Value = 0
For i = 1 To 2
For k = 1 To j
Sheet1.Cells(k + 1, i).Value = ""
Next k
Next i
j = 0
End Sub
附程序:
模块代码
Sub auto_open()
UserForm1.IeTimer1.Enabled = ValFalse
UserForm1.IeTimer1.Interval = 5000
UserForm1.Show
Application.OnUndo "Undo VB Procedure", "auto_open"
End Sub
Public j As Integer
采集窗体代码
Private Sub IeTimer1_Timer()
j = j + 1
Sheet1.Cells(2, 3).Value = j
Sheet1.Cells(j + 1, 1).Value = j
Sheet1.Cells(j + 1, 2).Value = j + 1 ''写采样值应为串口值MSComm1.Input
End Sub
Private Sub readdata_Click()
IeTimer1.Enabled = ValTrue
End Sub
Private Sub tingzhidu_Click()
IeTimer1.Enabled = ValFalse
End Sub
Private Sub tuichu_Click()
Sheet1.Protect ([711001])
End
End Sub
Private Sub UserForm_Activate()
Sheet1.Unprotect ([711001])
Sheet1.Cells(1, 1).Value = "序号"
Sheet1.Cells(1, 2).Value = "测量值"
Sheet1.Cells(1, 3).Value = "测量个数"
IeTimer1.Enabled = ValFalse
Sheet1.Activate
j = Sheet1.Cells(2, 3).Value
End Sub
Private Sub xtchushi_Click()
Dim i, k As Integer
IeTimer1.Enabled = ValFalse
Sheet1.Cells(2, 3).Value = 0
For i = 1 To 2
For k = 1 To j
Sheet1.Cells(k + 1, i).Value = ""
Next k
Next i
j = 0
End Sub
附程序:
附件:
[本地下载][此贴子已经被作者于2004-7-22 13:29:55编辑过]
枫