APD Toronto
asked on
VBA SetFocus in PowerPoint
Hi Experts,
Within a PowerPoint slide, I placed 2 textboxes. When the presenter types in a value, I would like to validate it before they move forward and regain focus to the textbox if invalid, using the code below., but I keep getting invalid use of property.
I've tried setting focus to the second textbox first, among other things as you'll see, but no luck...
Any help will be appreciate it.
Within a PowerPoint slide, I placed 2 textboxes. When the presenter types in a value, I would like to validate it before they move forward and regain focus to the textbox if invalid, using the code below., but I keep getting invalid use of property.
I've tried setting focus to the second textbox first, among other things as you'll see, but no luck...
Option Explicit
Private Sub txtCount_LostFocus()
Dim strVal As String
strVal = txtCount.Text
If (IsNumeric(strVal) = False) Then
MsgBox ("Please enter a valid number.")
txtCountHidden.SetFocus
Me.txtCount.SetFocus
'docmd.cancelevent
Else
txtCount.Text = FormatNumber(strVal)
txtCountHidden.Text = strVal
End If
End Sub
Any help will be appreciate it.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.