Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
On Error GoTo Error1
If Target.Row >= 7 Then
If Sheets("¿â´æ²éѯ").Range("AI" + CStr(Target.Row)).Value <> "" Then
Image1.Picture = LoadPicture(Sheets("¿â´æ²éѯ").Range("AI" + CStr(Target.Row)).Value)
Image1.Left = ActiveCell(1, 2).Left
Image1.Top = ActiveCell(1, 2).Top + 17
Image1.Visible = True
Else
MsgBox "ͼƬ²»´æÔÚ"
End If
End If
Exit Sub
Error1:
MsgBox "ͼƬ²»´æÔÚ"
Image1.Visible = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Image1.Visible = False
On Error Resume Next
If Target.Row >= 7 Then
Image1.Picture = LoadPicture(Sheets("¿â´æ²éѯ").Range("AI" + CStr(Target.Row)).Value)
End If
End Sub
在有些电脑上..不会出错..有些电脑上会出错..为什么?
删除是可以..但这样就看不了图片了
追答Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Image1.Visible = False '就是这一句,Image1事先未定义,可能引发错误"要求对象",删除试试
On Error Resume Next
If Target.Row >= 7 Then
Image1.Picture = LoadPicture(Sheets("¿â´æ²éѯ").Range("AI" + CStr(Target.Row)).Value)
Image1.Visible = True'再加上这句试试捏
End If
End Sub
已经是在调试了..有些电脑上..可以运行..有些不可以..好像和Office升级有关