|
▼亜矢 さん:
こんばんは
すでに、sasaさん、こたつねこさんからお答えがあるように、MouseDownをMouseUpに変更すれば正常稼動しますし
また、操作者から見ても従来と同じ操作で処理できますね。(2003環境で確認済み)
ダイアログでキャンセルボタンが押されたときのカバーもすると以下のような感じですね。
Private Sub TextBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call setFileName(TextBox1)
End Sub
Private Sub TextBox2_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call setFileName(TextBox2)
End Sub
Private Sub TextBox3_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call setFileName(TextBox3)
End Sub
Private Sub TextBox4_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call setFileName(TextBox4)
End Sub
Private Sub TextBox5_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call setFileName(TextBox5)
End Sub
Private Sub setFileName(tx As MSForms.TextBox)
With Application.FileDialog(msoFileDialogFilePicker)
.Show
If .SelectedItems.Count = 0 Then
tx.Text = Empty
Else
tx.Text = .SelectedItems(1)
End If
End With
AppActivate Caption
End Sub
|
|