Hi Danny, Just pass the name of file in belo metioned function it will remove all the special charactor into the name
Function RemoveSpecialChrs(s As String) As String Static RegEx As Object If RegEx Is Nothing Then Set RegEx = CreateObject("VBScript.RegExp") With RegEx .Global = True .Pattern = "\\|/|:|\*|""|\?|<|>\|| " End With End If RemoveSpecialChrs = RegEx.Replace(s, "") End Function Note: if you want to include more special charactars thwen just apply them in In Line: .Pattern = "\\|/|:|\*|""|\?|<|>\||*#|@|$ *" Regards Prince On Wednesday, January 2, 2013 8:34:59 PM UTC+5:30, dannym...@gmail.com wrote: > > In excel 2012 I'm using the name typed in a cell as a part of the filename > when saved via a macro. > Because the following characters /\*?"<>| are not allowed in a filename I > want to do a check in the cell. > The idea is to put a warning in a free cell that the name isn't allowed > when it contains one or more of the forbidden characters. > I used the =IF function in combination with =SEARCH but I don't know how > to use the formulas when I want to check on * ? or " > Can somebody help me with that? > Thanks. > Danny > -- Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To post to this group, send email to excel-macros@googlegroups.com. To unsubscribe from this group, send email to excel-macros+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros?hl=en.