?? dlgviewhistory.frm
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form View
BorderStyle = 3 'Fixed Dialog
Caption = "選擇歷史數(shù)據(jù)窗口"
ClientHeight = 1545
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 4455
Icon = "dlgViewHistory.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1545
ScaleWidth = 4455
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin MSComDlg.CommonDialog dlg2
Left = 1080
Top = 1320
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "產(chǎn)品信息"
Height = 1095
Left = 120
TabIndex = 2
Top = 120
Width = 2535
Begin VB.TextBox txtSNO
Height = 270
Left = 1155
TabIndex = 4
Top = 480
Width = 1215
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "機(jī)種番號:"
Height = 180
Left = 195
TabIndex = 3
Top = 480
Width = 900
End
End
Begin VB.CommandButton cmdBrowse
Caption = "瀏覽"
Height = 375
Left = 2760
TabIndex = 1
Top = 840
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "確定"
Height = 375
Left = 2760
TabIndex = 0
Top = 240
Width = 1215
End
End
Attribute VB_Name = "View"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public IsBrowsed As Boolean
Public FileToOpen, CurSNO As String
Private Sub cmdBrowse_Click()
With dlg2
.DialogTitle = "請選擇你要查看的文件(數(shù)據(jù)文件)"
.Filter = "xls文件(*.xls)|*.xls|所有文件(*.*)|*.*"
.ShowOpen
FileToOpen = .FileName
If .FileName <> "" Then
IsBrowsed = True
FileToOpen = .FileName
CurSNO = .FileTitle
txtSNO = CurSNO
End If
End With
End Sub
Private Sub Form_Activate()
'IsBrowsed = False
SendKeys "{HOME}+{END}"
End Sub
Private Sub Form_Load()
'================
Dim FileNumber As Integer
FileNumber = FreeFile
Dim hehe, haha As String
Open App.Path & "\Path.ini" For Input As #FileNumber
Line Input #FileNumber, haha
Close #FileNumber
'===================
dlg2.InitDir = haha
dlg2.CancelError = False
End Sub
Private Sub OKButton_Click()
CurSNO = Trim(txtSNO.Text)
'================
Dim FileNumber As Integer
FileNumber = FreeFile
Dim hehe, haha As String
Open App.Path & "\Path.ini" For Input As #FileNumber
Line Input #FileNumber, haha
Close #FileNumber
'===================
Dim a As Integer, Tagfile As Boolean
If IsBrowsed = False Then FileToOpen = haha & CurSNO & ".xls"
If Dir(FileToOpen) <> "" Then
GetExcel (FileToOpen)
Else
MsgBox "輸入有誤,請確認(rèn)您要查看的文件是否存在默認(rèn)路徑下及可用。" & vbCrLf & haha & "\" & CurSNO & ".xls", vbCritical, "打開文件錯誤"
SendKeys "{HOME}+{END}"
End If
Exit Sub
IsBrowsed = False
End Sub
Private Sub txtSNO_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
OKButton.SetFocus
End If
End Sub
Sub GetExcel(FileToOpen)
Dim MyXL, wbexcel As Object
Dim ExcelWasNotRunning As Boolean
On Error Resume Next
' Dim wbexcel As Excel.Application
Set MyXL = CreateObject("Excel.Application")
Set wbexcel = MyXL.Workbooks.Open(FileToOpen)
Set MyXL = GetObject(FileToOpen)
MyXL.Application.Visible = True
MyXL.Parent.Windows(1).Visible = True
'釋放對該應(yīng)用程序和電子數(shù)據(jù)表的引用。
'Set MyXL = Nothing
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -