我要实现当鼠标移到图片框的某一区域,读Excel表中的数据,并用文本框显示出来,
Option Explicit
Private Sub Form_load()
Text1.Width = 2000
Text1.Height = 300
Text1.BackColor = &HC0FFFF
Text1.Appearance = 0
Text1.Visible = False
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Visible = False
End SubPrivate Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.PSet (1100, 2100), vbRed
Dim str1 As String
Dim Xl As Object
Dim K As New Excel.Application
Set Xl = K.Workbooks.Open("C:\123.XLS")
str1 = Xl.Worksheets(1).Cells(2, 1).Value
Text1.Text = str1
If X > 1000 And X < 1200 And Y > 2000 And Y < 2200 Then
Text1.Visible = True
Else
Text1.Visible = False
End If
End Sub
怎么运行时显示“操作系统当前的配置不能运行此程序”而且我要关掉时显示“部件要求挂起”
请大家教教我怎么该啊?感谢了!
Option Explicit
Private Sub Form_load()
Text1.Width = 2000
Text1.Height = 300
Text1.BackColor = &HC0FFFF
Text1.Appearance = 0
Text1.Visible = False
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Visible = False
End SubPrivate Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture1.PSet (1100, 2100), vbRed
Dim str1 As String
Dim Xl As Object
Dim K As New Excel.Application
Set Xl = K.Workbooks.Open("C:\123.XLS")
str1 = Xl.Worksheets(1).Cells(2, 1).Value
Text1.Text = str1
If X > 1000 And X < 1200 And Y > 2000 And Y < 2200 Then
Text1.Visible = True
Else
Text1.Visible = False
End If
End Sub
怎么运行时显示“操作系统当前的配置不能运行此程序”而且我要关掉时显示“部件要求挂起”
请大家教教我怎么该啊?感谢了!
Set Xl = K.Workbooks.Open("C:\123.XLS")
str1 = Xl.Worksheets(1).Cells(2, 1).Value
这些不要放在mousemove事件中。mousemove事件是会非常频繁产生的……
Excel表中cell(2,2)中的数据。这怎么处理呢?再请你帮一下忙。Option Explicit
Private Sub Form_load()
Text1.Width = 2000
Text1.Height = 300
Text1.BackColor = &HC0FFFF
Text1.Appearance = 0
Text1.Visible = False
Dim str1 As String
Dim Xl As Object
Dim K As New Excel.Application
Set Xl = K.Workbooks.Open("C:\123.XLS")
str1 = Xl.Worksheets(1).Cells(2, 1).Value
Text1.Text = str1
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Visible = False
End SubPrivate Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim str1 As String
Dim Xl As Object
Picture1.PSet (1100, 2100), vbRed
If X > 1000 And X < 1200 And Y > 2000 And Y < 2200 Then
Text1.Visible = True
Else
Text1.Visible = False
End If
End Sub