0
私はVBAにはとても親しまれています。私はWordで私のユーザーフォームのいくつかのキューバナーを作成しようとしています。私が立ち往生する前に、私は約半分の方法を得た。私はキューバナーが消える場所を持っていて、フォーカスがあるとテキストボックスをクリアします。ユーザーが独自のテキストを入力すると、そのテキストも保持されます。気取ったキューバナー
しかし、ユーザーがクリアしたテキストボックスに何も入力しなければ、その属性(グレーのテキストとイタリック体)とともにキューのバナーを置き換えます。私はそれを働かせるように見えません。以下に、このテキストボックスに関連するすべてのコードを示します。問題は私が思うLeaveイベントです。
Private Sub UserForm_Initialize()
Me.txbShipToName1.Text = "name"
Me.txbShipToName1.Font.Italic = True
Me.txbShipToName1.ForeColor = &H80000006
End Sub
Private Sub txbShipToName1_Enter()
If Me.ActiveControl Is Me.txbShipToName1 And Me.txbShipToName1.Text = "name" Then
txbShipToName1.Font.Italic = False
txbShipToName1.ForeColor = &H80000008
txbShipToName1.Text = ""
End If
End Sub
Private Sub txbShipToName1_Leave()
If Me.ActiveControl Is Not txbShipToName1 And Me.txbShipToName1.Text = "" Then
txbShipToName1.Font.Italic = True
txbShipToName1.ForeColor = &H80000006
txbShipToName1.Text = LCase(txbShipToName1.Text)
txbShipToName1.Text = "name"
End If
End Sub
Private Sub txbShipToName1_Change()
If Me.ActiveControl Is Me.txbShipToName1 And Me.txbShipToName1 <> "name" Then
txbShipToName1.Text = UCase(txbShipToName1.Text)
End If
End Sub