Daniel_Roberts
New Member
- Joined
- Jun 4, 2019
- Messages
- 2
Hello all,
I'm building a worksheet with several ActiveX text boxes for data entry. I'm trying to write code that would prompt the user with a message box listing any text boxes that they have not completed before moving the entries to the spreadsheet. When I run my code, it doesn't return an error, however it also doesn't seem to work... Thanks in advance!
I'm building a worksheet with several ActiveX text boxes for data entry. I'm trying to write code that would prompt the user with a message box listing any text boxes that they have not completed before moving the entries to the spreadsheet. When I run my code, it doesn't return an error, however it also doesn't seem to work... Thanks in advance!
Code:
Sub TEST()
Dim fTextBox As OLEObject
Dim xTxtName As String
Dim xEptTxtName As String
For Each fTextBox In Sheet2.OLEObjects
If TypeName(fTextBox) = "TextBox" Then
If fTextBox.Text = "" Then
xEptTxtName = xEptTxtName & fTextBox.Name & vbNewLine
End If
End If
Next
If xEptTxtName <> "" Or xTxtName <> "" Then
MsgBox ("Please provide the following information:" & vbNewLine & "" & vbNewLine & xEptTxtName & vbNewLine & xTxtName)
End If
End Sub