Jacob - thanks for your reply.
I am going to post the code I have. Please take a look and see what needs to be done.
In ThisWorkBook I have:
Private Sub Workbook_NewSheet(ByVal Sh As Object)
UserForm4.Show
End Sub
In Userform4 I have:
Private Sub CommandButton1_Click()
With ActiveSheet
Dim shname As String
shname = StrConv(Me.TextBox1.Text, vbProperCase)
Dim i As Long, hasBadVal As Boolean
hasBadVal = False
For i = 1 To Len(Me.TextBox1.Value) Step 1
Select Case Mid(Me.TextBox1.Value, i, 1)
Case "?", "/", "\", ":", "]", "[", "*"
hasBadVal = True
Exit For
End Select
Next i
If hasBadVal Then
MsgBox "An unexceptable name has been entered into the textbox!", _
vbCritical, "ERROR"
Me.TextBox1.Value = ""
Me.TextBox1.SetFocus
Else
ActiveSheet.Name = shname
UserForm4.Hide
Unload Me
End If
End With
End Sub
I tried adding your code to the Thisworkbook section. I am getting the same results.
Thanks,
Kurt