VB and VBA Users Source Code: Returning a valid Excel Sheet Name
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Returning a valid Excel Sheet Name
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Sunday, November 23, 2003
Hits:
2264
Category:
VBA (Visual Basic for Applications)
Article:
The following function removes invalid characters from Excel Sheet Names. 'Purpose : Returns a valid Excel Sheet Name 'Inputs : sSheetName The sheet name to clean the invalid characters from 'Outputs : Returns a valid sheet name 'Author : Andrew Baker 'Date : 25/03/2001 'Notes : Function ExcelSheetNameValid(sSheetName As String) As String Const csInvalidChars As String = ":\/?*[]" Dim lThisChar As Long ExcelSheetNameValid = sSheetName For lThisChar = 1 To Len(csInvalidChars) ExcelSheetNameValid = Replace$(ExcelSheetNameValid , mid(csInvalidChars, lThisChar, 1), "") Next ExcelSheetNameValid = Left$(ExcelSheetNameValid,31) End Function
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder