我vb程序运行时读了Excel表格,然而我把vb程序关掉,想打开Excel表格看看里面的数据,他却显示“文档已经打开…………”,请问高手我该怎么把他完全关掉,感谢了
解决方案 »
- 如何将搜索出的模糊匹配数据输出到DataGrid
- 关于MSCOMM控件的难题!
- 关于UPDATE的问题
- 送分了,我不活了
- 调用sql server存储过程,传递adDecimal参数精度问题
- 控件
- VBA 调整Excel柱状图 比例大小 大神来帮帮我把
- 高手大侠请来指点一二吧!!! 我实在是想不出来呀!!斑竹请进来!!
- 祝贺http://www.wzjcw.net/vbgood/taishan/index.html访问量突破4000,散分!
- 开第二个问题:用SQLSERVER建数据库,要求通过MODE访问,软件具体如何做并注意什么问题?
- buff是什么函数?有什么作用?格式怎么样?
- 怎么删除vb中所有的注释;另DataGrid有水平滚动条,用键盘左右键移动,每次都移动很少,怎么设置移动多一点?
Option Explicit
Dim j1 As Integer
Dim j2 As Integer
Dim j3 As Integer
Dim j4 As Integer
Dim j5 As Integer
Dim j6 As Integer
Dim r As Integer, c As Integer
Dim cellStr(10, 8) As String
Dim r0 As Integer, c0 As Integer
Dim Xl As Object
Dim K As New Excel.Application Private Sub Picture1_Click()
BackColor = vbWhite
FillStyle = 0
Picture1.PSet (1225, 714), vbRed
Picture1.PSet (875, 1103), vbRed
Picture1.PSet (690, 1492), vbRed
Picture1.PSet (600, 1881), vbRed
Picture1.PSet (600, 2270), vbRed
Picture1.PSet (690, 2659), vbRed
Picture1.PSet (875, 3048), vbRed
Picture1.PSet (1225, 3437), vbRedPicture1.PSet (1655, 714), vbRed
Picture1.PSet (1440, 1103), vbRed
Picture1.PSet (1332, 1492), vbRed
Picture1.PSet (1277, 1881), vbRed
Picture1.PSet (1277, 2270), vbRed
Picture1.PSet (1332, 2659), vbRed
Picture1.PSet (1440, 3048), vbRed
Picture1.PSet (1655, 3437), vbRedPicture1.PSet (2085, 714), vbRed
Picture1.PSet (2005, 1103), vbRed
Picture1.PSet (1974, 1492), vbRed
Picture1.PSet (1954, 1881), vbRed
Picture1.PSet (1954, 2270), vbRed
Picture1.PSet (1974, 2659), vbRed
Picture1.PSet (2005, 3048), vbRed
Picture1.PSet (2085, 3437), vbRedPicture1.PSet (2515, 714), vbRed
Picture1.PSet (2570, 1103), vbRed
Picture1.PSet (2616, 1492), vbRed
Picture1.PSet (2631, 1881), vbRed
Picture1.PSet (2631, 2270), vbRed
Picture1.PSet (2616, 2659), vbRed
Picture1.PSet (2570, 3048), vbRed
Picture1.PSet (2515, 3437), vbRedPicture1.PSet (2945, 714), vbRed
Picture1.PSet (3135, 1103), vbRed
Picture1.PSet (3258, 1492), vbRed
Picture1.PSet (3308, 1881), vbRed
Picture1.PSet (3308, 2270), vbRed
Picture1.PSet (3258, 2659), vbRed
Picture1.PSet (3135, 3048), vbRed
Picture1.PSet (2945, 3437), vbRedPicture1.PSet (3375, 714), vbRed
Picture1.PSet (3700, 1103), vbRed
Picture1.PSet (3900, 1492), vbRed
Picture1.PSet (3985, 1881), vbRed
Picture1.PSet (3985, 2270), vbRed
Picture1.PSet (3900, 2659), vbRed
Picture1.PSet (3700, 3048), vbRed
Picture1.PSet (3375, 3437), vbRedPicture1.CurrentX = 200: Picture1.CurrentY = 200
Picture1.Print "我的球体"
End SubPrivate Sub Form_load()
Text1.Width = 2000
Text1.Height = 300
Text1.BackColor = &HC0FFFF
Text1.Appearance = 0
Text1.Visible = False
j1 = 0
j2 = 0
j3 = 0
j4 = 0
j5 = 0
j6 = 0
Set Xl = K.Workbooks.Open("C:\123.XLS")
r0 = 1 '起始行,自行设定
c0 = 1 '起始列,自行设定
For r = 0 To 9
For c = 0 To 7
cellStr(r, c) = Xl.Worksheets(1).Cells(r + r0, c + c0).Value
Next c
Next r
End Sub
Private Sub Command1_Click()j1 = j1 + 1
If 0 + j1 = 10 Then
j1 = 0
End If j2 = j2 + 1
If 1 + j2 = 10 Then
j2 = -1
End Ifj3 = j3 + 1
If 2 + j3 = 10 Then
j3 = -2
End Ifj4 = j4 + 1
If 3 + j4 = 10 Then
j4 = -3
End Ifj5 = j5 + 1
If 4 + j5 = 10 Then
j5 = -4
End Ifj6 = j6 + 1
If 5 + j6 = 10 Then
j6 = -5
End If
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Visible = False
End Sub
If X > 1175 And X < 1275 And Y > 670 And Y < 770 Then
Text1.Text = cellStr(0, 0)
Text1.Visible = True
ElseIf X > 825 And X < 925 And Y > 1050 And Y < 1150 Then
Text1.Text = cellStr(0 + j1, 1)
Text1.Visible = True
ElseIf X > 640 And X < 740 And Y > 1450 And Y < 1550 Then
Text1.Text = cellStr(0 + j1, 2)
Text1.Visible = True
ElseIf X > 550 And X < 650 And Y > 1830 And Y < 1930 Then
Text1.Text = cellStr(0 + j1, 3)
Text1.Visible = True
ElseIf X > 550 And X < 650 And Y > 2220 And Y < 2320 Then
Text1.Text = cellStr(0 + j1, 4)
Text1.Visible = True
ElseIf X > 640 And X < 740 And Y > 2610 And Y < 2710 Then
Text1.Text = cellStr(0 + j1, 5)
Text1.Visible = True
ElseIf X > 825 And X < 925 And Y > 3000 And Y < 3100 Then
Text1.Text = cellStr(0 + j1, 6)
Text1.Visible = True
ElseIf X > 1175 And X < 1275 And Y > 3380 And Y < 3480 Then
Text1.Text = cellStr(0 + j1, 7)
Text1.Visible = True
ElseIf X > 1600 And X < 1700 And Y > 670 And Y < 770 Then
Text1.Text = cellStr(1 + j2, 0)
Text1.Visible = True
ElseIf X > 1400 And X < 1500 And Y > 1050 And Y < 1150 Then
Text1.Text = cellStr(1 + j2, 1)
Text1.Visible = True
ElseIf X > 1280 And X < 1380 And Y > 1450 And Y < 1550 Then
Text1.Text = cellStr(1 + j2, 2)
Text1.Visible = True
ElseIf X > 1220 And X < 1320 And Y > 1830 And Y < 1930 Then
Text1.Text = cellStr(1 + j2, 3)
Text1.Visible = True
ElseIf X > 1220 And X < 1320 And Y > 2220 And Y < 2320 Then
Text1.Text = cellStr(1 + j2, 4)
Text1.Visible = True
ElseIf X > 1280 And X < 1380 And Y > 2610 And Y < 2710 Then
Text1.Text = cellStr(1 + j2, 5)
Text1.Visible = True
ElseIf X > 1400 And X < 1500 And Y > 3000 And Y < 3100 Then
Text1.Text = cellStr(1 + j2, 6)
Text1.Visible = True
ElseIf X > 1600 And X < 1700 And Y > 3380 And Y < 3480 Then
Text1.Text = cellStr(1 + j2, 7)
Text1.Visible = True
ElseIf X > 2030 And X < 2130 And Y > 670 And Y < 770 Then
Text1.Text = cellStr(2 + j3, 0)
Text1.Visible = True
ElseIf X > 1950 And X < 2050 And Y > 1050 And Y < 1150 Then
Text1.Text = cellStr(2 + j3, 1)
Text1.Visible = True
ElseIf X > 1920 And X < 2020 And Y > 1450 And Y < 1550 Then
Text1.Text = cellStr(2 + j3, 2)
Text1.Visible = True
ElseIf X > 1900 And X < 2000 And Y > 1830 And Y < 1930 Then
Text1.Text = cellStr(2 + j3, 3)
Text1.Visible = True
ElseIf X > 1900 And X < 2000 And Y > 2220 And Y < 2320 Then
Text1.Text = cellStr(2 + j3, 4)
Text1.Visible = True
ElseIf X > 1920 And X < 2020 And Y > 2610 And Y < 2710 Then
Text1.Text = cellStr(2 + j3, 5)
Text1.Visible = True
ElseIf X > 1950 And X < 2050 And Y > 3000 And Y < 3100 Then
Text1.Text = cellStr(2 + j3, 6)
Text1.Visible = True
ElseIf X > 2030 And X < 2130 And Y > 3380 And Y < 3480 Then
Text1.Text = cellStr(2 + j3, 7)
Text1.Visible = True
ElseIf X > 2460 And X < 2560 And Y > 670 And Y < 770 Then
Text1.Text = cellStr(3 + j4, 0)
Text1.Visible = True
ElseIf X > 2520 And X < 2620 And Y > 1050 And Y < 1150 Then
Text1.Text = cellStr(3 + j4, 1)
Text1.Visible = True
ElseIf X > 2570 And X < 2670 And Y > 1450 And Y < 1550 Then
Text1.Text = cellStr(3 + j4, 2)
Text1.Visible = True
ElseIf X > 2580 And X < 2680 And Y > 1830 And Y < 1930 Then
Text1.Text = cellStr(3 + j4, 3)
Text1.Visible = True
ElseIf X > 2580 And X < 2680 And Y > 2220 And Y < 2320 Then
Text1.Text = cellStr(3 + j4, 4)
Text1.Visible = True
ElseIf X > 2570 And X < 2670 And Y > 2610 And Y < 2710 Then
Text1.Text = cellStr(3 + j4, 5)
Text1.Visible = True
ElseIf X > 2520 And X < 2620 And Y > 3000 And Y < 3100 Then
Text1.Text = cellStr(3 + j4, 6)
Text1.Visible = True
ElseIf X > 2460 And X < 2560 And Y > 3380 And Y < 3480 Then
Text1.Text = cellStr(3 + j4, 7)
Text1.Visible = True
ElseIf X > 2900 And X < 3000 And Y > 670 And Y < 770 Then
Text1.Text = cellStr(4 + j5, 0)
Text1.Visible = True
ElseIf X > 3080 And X < 3180 And Y > 1050 And Y < 1150 Then
Text1.Text = cellStr(4 + j5, 1)
Text1.Visible = True
ElseIf X > 3210 And X < 3310 And Y > 1450 And Y < 1550 Then
Text1.Text = cellStr(4 + j5, 2)
Text1.Visible = True
ElseIf X > 3250 And X < 3350 And Y > 1830 And Y < 1930 Then
Text1.Text = cellStr(4 + j5, 3)
Text1.Visible = True
ElseIf X > 3250 And X < 3350 And Y > 2220 And Y < 2320 Then
Text1.Text = cellStr(4 + j5, 4)
Text1.Visible = True
ElseIf X > 3210 And X < 3310 And Y > 2610 And Y < 2710 Then
Text1.Text = cellStr(4 + j5, 5)
Text1.Visible = True
ElseIf X > 3080 And X < 3180 And Y > 3000 And Y < 3100 Then
Text1.Text = cellStr(4 + j5, 6)
Text1.Visible = True
ElseIf X > 2900 And X < 3000 And Y > 3380 And Y < 3480 Then
Text1.Text = cellStr(4 + j5, 7)
Text1.Visible = True
ElseIf X > 3325 And X < 3425 And Y > 670 And Y < 770 Then
Text1.Text = cellStr(5 + j6, 0)
Text1.Visible = True
ElseIf X > 3650 And X < 3750 And Y > 1050 And Y < 1150 Then
Text1.Text = cellStr(5 + j6, 1)
Text1.Visible = True
ElseIf X > 3850 And X < 3950 And Y > 1450 And Y < 1550 Then
Text1.Text = cellStr(5 + j6, 2)
Text1.Visible = True
ElseIf X > 3935 And X < 4035 And Y > 1830 And Y < 1930 Then
Text1.Text = cellStr(5 + j6, 3)
Text1.Visible = True
ElseIf X > 3935 And X < 4035 And Y > 2220 And Y < 2320 Then
Text1.Text = cellStr(5 + j6, 4)
Text1.Visible = True
ElseIf X > 3850 And X < 3950 And Y > 2610 And Y < 2710 Then
Text1.Text = cellStr(5 + j6, 5)
Text1.Visible = True
ElseIf X > 3650 And X < 3750 And Y > 3000 And Y < 3100 Then
Text1.Text = cellStr(5 + j6, 6)
Text1.Visible = True
ElseIf X > 3325 And X < 3425 And Y > 3380 And Y < 3480 Then
Text1.Text = cellStr(5 + j6, 7)
Text1.Visible = True
Else
Text1.Visible = False
End If
End Sub
r0 = 1 '起始行,自行设定
c0 = 1 '起始列,自行设定
For r = 0 To 9
For c = 0 To 7
cellStr(r, c) = Xl.Worksheets(1).Cells(r + r0, c + c0).Value
Next c
Next r
'再加上
Xl.close
一般 k.close
set k=nothing 就行拉