目的:单击第六列的格子,得到同一行中第5列格子里存的内容
下面是我的程序。
Private Sub FlexZl_Click()
Dim temprow As Long
If FlexZl.Col = 6 Then
Debug.Print FlexZl.Row
temprow = FlexZl.Row
If FlexZl.Row <> gridrow Then
If gridrow <> 0 Then
If gridrow < FlexZl.Rows Then
FlexZl.Row = gridrow
Else
FlexZl.Row = 0
End If
FlexZl.CellBackColor = &HE0E0E0
End If
FlexZl.Row = temprow
FlexZl.CellBackColor = vbRed
gridrow = temprow
FlexZl.Col = 5
If Dir(FlexZl.Text) <> "" Then
MsgBox "hah"
ElseIf Dir(FlexZl.Text) = "" Then
MsgBox "无效"
End If MediaZl.Enabled = True
MediaZl.FileName = FlexZl.Text Else
If FlexZl.CellBackColor = vbRed Then
FlexZl.CellBackColor = &HE0E0E0
MediaZl.FileName = ""
MediaZl.Enabled = False
Else
FlexZl.CellBackColor = vbRed
MediaZl.ShowPositionControls = False
MediaZl.Enabled = True
FlexZl.Col = 5
MediaZl.FileName = FlexZl.Text
End If
End If
End If
End Sub
下面是我的程序。
Private Sub FlexZl_Click()
Dim temprow As Long
If FlexZl.Col = 6 Then
Debug.Print FlexZl.Row
temprow = FlexZl.Row
If FlexZl.Row <> gridrow Then
If gridrow <> 0 Then
If gridrow < FlexZl.Rows Then
FlexZl.Row = gridrow
Else
FlexZl.Row = 0
End If
FlexZl.CellBackColor = &HE0E0E0
End If
FlexZl.Row = temprow
FlexZl.CellBackColor = vbRed
gridrow = temprow
FlexZl.Col = 5
If Dir(FlexZl.Text) <> "" Then
MsgBox "hah"
ElseIf Dir(FlexZl.Text) = "" Then
MsgBox "无效"
End If MediaZl.Enabled = True
MediaZl.FileName = FlexZl.Text Else
If FlexZl.CellBackColor = vbRed Then
FlexZl.CellBackColor = &HE0E0E0
MediaZl.FileName = ""
MediaZl.Enabled = False
Else
FlexZl.CellBackColor = vbRed
MediaZl.ShowPositionControls = False
MediaZl.Enabled = True
FlexZl.Col = 5
MediaZl.FileName = FlexZl.Text
End If
End If
End If
End Sub
if .col=5 then
.col=4
msgbox .text
end if
end with
例如C:\Documents and Settings\Administrator\桌面\调度总机3.16\rec\20050316202456.wav
然后mediaplayer.filename=这个路径
现在debug.print flex.text能得出这个路径
但mediaplayer.filename=flex.text就是空的