Saturday, July 30, 2011

Remove Special Character from a String :

If You want to Remove Extra Character from you String , You want to Keep only Alphabets and Numeric Character You can use the Below Function :





Public Function SheetName(Shname As String) As String Dim Cod As Integer Dim ShN As String
            For i = 1 To Len(Shname)
                Cod = Asc(Mid(Shname, i, 1))
                        If (Cod > 64 And Cod < 91) Or (Cod > 96 And Cod < 123) Or (Cod > 79 And Cod < 90) Then
                        ShN = ShN & Mid(Shname, i, 1)
                        End If
            Next
            SheetName = ShN
End Function

No comments: