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

📄 main_xsyw_xsdr.frm

📁 EMS是一个企业营销管理系统,功能强大,供大家享用,希望大家多多支持!!
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form main_xsyw_xsdr 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "从文件导入"
   ClientHeight    =   4500
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6345
   Icon            =   "main_xsyw_xsdr.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4500
   ScaleWidth      =   6345
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   675
      Top             =   2715
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command3 
      Caption         =   "取消"
      Height          =   390
      Left            =   4920
      TabIndex        =   10
      Top             =   3975
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00008000&
      Height          =   1620
      Left            =   75
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      TabIndex        =   9
      Top             =   2235
      Width           =   6180
   End
   Begin VB.Frame Frame1 
      Caption         =   "导入数据类型"
      Height          =   675
      Left            =   75
      TabIndex        =   5
      Top             =   1500
      Width           =   6165
      Begin VB.OptionButton Option2 
         Caption         =   "销售计划数据"
         Height          =   210
         Left            =   1905
         TabIndex        =   7
         Top             =   330
         Width           =   1425
      End
      Begin VB.OptionButton Option1 
         Caption         =   "销售数据"
         Height          =   210
         Left            =   255
         TabIndex        =   6
         Top             =   330
         Value           =   -1  'True
         Width           =   1425
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "导入文件格式说明"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   -1  'True
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   195
         Left            =   4290
         MouseIcon       =   "main_xsyw_xsdr.frx":000C
         MousePointer    =   99  'Custom
         TabIndex        =   8
         Top             =   315
         Width           =   1500
      End
   End
   Begin VB.CommandButton Command2 
      Caption         =   "确定"
      Height          =   390
      Left            =   3405
      TabIndex        =   4
      Top             =   3975
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "浏览..."
      Height          =   330
      Left            =   5370
      TabIndex        =   3
      Top             =   1005
      Width           =   870
   End
   Begin VB.TextBox Text1 
      Height          =   330
      Left            =   75
      TabIndex        =   2
      Top             =   1005
      Width           =   5295
   End
   Begin VB.Label Label2 
      Caption         =   "导入文件名:"
      Height          =   225
      Left            =   120
      TabIndex        =   1
      Top             =   750
      Width           =   2085
   End
   Begin VB.Label Label1 
      Caption         =   "说明:本功能把文件中的销售数据导入到本资料库中。       目前只支持excel格式的文件。"
      Height          =   390
      Left            =   135
      TabIndex        =   0
      Top             =   165
      Width           =   4380
   End
End
Attribute VB_Name = "main_xsyw_xsdr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Dim xstb As String
Dim intNew As Integer
Dim r As Integer, c As Integer
Dim newxls As Excel.Application
Dim newbook As Excel.Workbook
Dim newsheet As Excel.Worksheet
Private Sub Label3_Click()
  Set newxls = CreateObject("Excel.Application") '创建excel应用程序,打开excel2000
  If Option1.Value = True Then
    xstb = "销售表"
  Else
    xstb = "销售计划表"
  End If
  Set newbook = newxls.Workbooks.Open(App.Path & "\" & xstb & ".xls")
  newxls.Visible = True
End Sub
Private Sub Command1_Click()
  CommonDialog1.ShowOpen
  CommonDialog1.Filter = "Excel文件(*.xls)|*.xls"
  Text1 = CommonDialog1.FileName
End Sub
Private Sub Command2_Click()
  If Option1.Value = True Then
    xstb = "销售表"
  Else
    xstb = "销售计划表"
  End If
  Text2 = "正在导入数据......"
  Set newxls = CreateObject("Excel.Application") '创建excel应用程序,打开excel2000
  Set newbook = newxls.Workbooks.Open(Text1)
  Set newsheet = newbook.Worksheets(xstb)
  Me.Enabled = False
  rs1.Open xstb, Cnn, adOpenKeyset, adLockOptimistic
  intOr = rs1.RecordCount
  For r = 2 To 2000
    If newsheet.Cells(r, 1) <> "" Then
       rs1.AddNew
       For c = 1 To rs1.Fields.Count - 2
          rs1.Fields(c - 1) = newsheet.Cells(r, c)
       Next c
       rs1.Update
       intNew = intNew + 1
     End If
  Next r
  rs1.Close
  newxls.Quit
  Text2 = Text2 & Chr(13) & Chr(10) & "共成功导入" & intNew & "条数据。"
  Me.Enabled = True
End Sub
Private Sub Command3_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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