⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgviewhistory.frm

📁 该程序基于RS232串口通讯的激光检测钻头钻孔内径及外径等相关参数从而判断该产品是否为OK/NG
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form View 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "选择历史数据窗口"
   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         =   "产品信息"
      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         =   "机种番号:"
         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 = "请选择你要查看的文件(数据文件)"
        .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 "输入有误,请确认您要查看的文件是否存在默认路径下及可用。" & 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
   '释放对该应用程序和电子数据表的引用。
   'Set MyXL = Nothing
   
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -