A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Strip illegal character from filename



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old May 19th 08, 09:10 AM posted to microsoft.public.outlook.program_vba
ExcelLars
external usenet poster
 
Posts: 19
Default Strip illegal character from filename

Is it possible to do this with less code?

EmneRensket = Rensket(Emne, ":")
EmneRensket = Rensket(Emne, ";")
EmneRensket = Rensket(Emne, ".")
EmneRensket = Rensket(Emne, ",")
EmneRensket = Rensket(Emne, "\")
EmneRensket = Rensket(Emne, "/")
EmneRensket = Rensket(Emne, "*")
EmneRensket = Rensket(Emne, "[")
EmneRensket = Rensket(Emne, "]")
EmneRensket = Rensket(Emne, "?")
EmneRensket = Rensket(Emne, "!")
EmneRensket = Rensket(Emne, "'")
EmneRensket = Rensket(Emne, "")
EmneRensket = Rensket(Emne, "")
EmneRensket = Rensket(Emne, "|")

Function Rensket(text As String, illegal As String) As String
Dim Ch As String
For i = 1 To Len(illegal)
Ch = Mid(illegal, i, 1)
While InStr(text, Ch) 0
text = Left(text, InStr(text, Ch) - 1) & Right(text, Len(text)
- InStr(text, Ch))
Wend
Next
Rensket = text
End Function
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
incoming mail strip enclosures ernst-NL[_2_] Outlook - Calandaring 1 November 9th 07 02:38 AM
Change filename Peter Marchert Outlook and VBA 17 March 29th 07 09:24 PM
Strip Attachments AFTER sending JustinHereForNow Outlook and VBA 1 March 6th 07 10:42 PM
Any way to strip attachments from archived email? ggull Outlook Express 4 April 5th 06 04:40 PM
strip out leading text from a forwarded email. anonymous Outlook and VBA 1 March 17th 06 10:55 AM


All times are GMT +1. The time now is 03:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.