📄 导出表格.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "ComDlg32.OCX"
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form FrmToExcel
BorderStyle = 1 'Fixed Single
Caption = "导出表格内容到 Excel 文件中"
ClientHeight = 4020
ClientLeft = 45
ClientTop = 375
ClientWidth = 8175
LinkTopic = "Form19"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 4020
ScaleWidth = 8175
StartUpPosition = 3 '窗口缺省
Begin CSCommand.Command Command2
Height = 360
Left = 2055
TabIndex = 10
Top = 2715
Width = 900
_ExtentX = 1588
_ExtentY = 635
IconAlign = 0
Icon = "导出表格.frx":0000
Caption = "开始 &B"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 0
Top = 4125
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
ForeColor = &H00FF0000&
Height = 225
Left = 3075
TabIndex = 8
Text = "Text1"
Top = 2280
Width = 4920
End
Begin CSCommand.Command Command1
Height = 360
Left = 2055
TabIndex = 4
Top = 2190
Width = 900
_ExtentX = 1588
_ExtentY = 635
IconAlign = 0
Icon = "导出表格.frx":001C
Caption = "浏览 &L"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "* 导出功能使用之前请确定本计算机已经安装有微软 Office 中的 Excel 组件。"
ForeColor = &H00008080&
Height = 180
Left = 1740
TabIndex = 13
Top = 3735
Width = 6390
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "执行完毕!"
ForeColor = &H00FF0000&
Height = 225
Left = 3150
TabIndex = 12
Top = 3090
Width = 4785
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "准备就绪。"
ForeColor = &H00FF0000&
Height = 240
Left = 3150
TabIndex = 11
Top = 2820
Width = 4755
End
Begin VB.Shape Shape6
BorderColor = &H00A0A0A0&
Height = 660
Left = 3030
Top = 2700
Width = 5025
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Height = 240
Left = 300
TabIndex = 9
Top = 4050
Visible = 0 'False
Width = 1365
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "Label7"
ForeColor = &H00808080&
Height = 210
Left = 1485
TabIndex = 7
Top = 1635
Width = 6390
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "Label6"
ForeColor = &H00808080&
Height = 210
Left = 5580
TabIndex = 6
Top = 1260
Width = 2280
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "Label5"
ForeColor = &H00808080&
Height = 180
Left = 1500
TabIndex = 5
Top = 1275
Width = 2745
End
Begin VB.Shape Shape5
BackColor = &H00E0E0E0&
BackStyle = 1 'Opaque
BorderColor = &H00C0C0C0&
FillColor = &H00E0E0E0&
Height = 315
Left = 3015
Shape = 4 'Rounded Rectangle
Top = 2205
Width = 5040
End
Begin VB.Image Image2
Height = 1695
Left = 135
Picture = "导出表格.frx":0038
Top = 2115
Width = 1800
End
Begin VB.Shape Shape4
BorderColor = &H00C0C0C0&
Height = 315
Left = 1425
Shape = 4 'Rounded Rectangle
Top = 1560
Width = 6510
End
Begin VB.Shape Shape3
BorderColor = &H00C0C0C0&
Height = 315
Left = 5505
Shape = 4 'Rounded Rectangle
Top = 1185
Width = 2415
End
Begin VB.Shape Shape2
BorderColor = &H00C0C0C0&
Height = 315
Left = 1425
Shape = 4 'Rounded Rectangle
Top = 1200
Width = 2925
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数据条数:"
ForeColor = &H00404040&
Height = 180
Left = 4590
TabIndex = 3
Top = 1260
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数据范围:"
ForeColor = &H00404040&
Height = 180
Left = 525
TabIndex = 2
Top = 1620
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "表格窗体:"
ForeColor = &H00404040&
Height = 180
Left = 525
TabIndex = 1
Top = 1260
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = " 将要被导出的范围 "
ForeColor = &H00808080&
Height = 180
Left = 255
TabIndex = 0
Top = 960
Width = 1620
End
Begin VB.Image Image1
Height = 885
Left = -45
Picture = "导出表格.frx":2A53
Top = -30
Width = 9885
End
Begin VB.Shape Shape1
BorderColor = &H00A0A0A0&
Height = 975
Left = 120
Top = 1050
Width = 7920
End
End
Attribute VB_Name = "FrmToExcel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2007/12/24
'描 述:商务名片及客户资料管理系统 Ver 1.73
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Option Explicit
Private Sub Command1_Click()
CommonDialog1.Filter = "excel文件(*.xls)|*.xls"
CommonDialog1.CancelError = False
Me.CommonDialog1.ShowSave
'MsgBox CommonDialog1.FileName
If CommonDialog1.FileName = "" Then
Exit Sub
End If
If Dir(Trim(CommonDialog1.FileName)) <> "" Then
MsgBox "设定的目标文件 Excel 文件已经存在,不得使用已经存在的文件的文件名。", vbInformation
Else
Text1.Text = Trim(CommonDialog1.FileName)
End If
End Sub
Private Sub Command2_Click()
If Label8.Caption = 1 Then
ShangJiaToExcel '导出商家列表
ElseIf Label8.Caption = 2 Then
RenToExcel '导出联系人信息
ElseIf Label8.Caption = 3 Then
BaifangToExcel '导出拜访记录列表
ElseIf Label8.Caption = 4 Then
UrlsToExcel '导出网址收藏列表
Else
MsgBox "调用通用导出过程函数的时候出现了错误:无法识别的数据来源标志量。可以尝试重新运行本程序。", vbInformation
End If
End Sub
Private Sub ShangJiaToExcel() '本函数用于导出商家列表信息
Command2.Enabled = False
On Error GoTo ddd
Label9 = "正在验证目标文件名称是否可以使用。"
If Trim(Text1.Text) = "" Then
Label9.Caption = "没有可用的目标文件名。"
Command2.Enabled = True
Exit Sub
End If
If Right(Trim(Text1.Text), 4) <> ".xls" Then
Label9.Caption = "非法的目标文件名。"
Command2.Enabled = True
Exit Sub
End If
If Dir(Trim(Text1.Text)) <> "" Then
MsgBox "设定的目标文件 Excel 文件已经存在,不得使用已经存在的文件的文件名。", vbInformation
Label9.Caption = "准备就绪。"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -