Jump to content

Recommended Posts

Posted (edited)

I'm just using the data import preparation sheet from kerboodle! and had a quick look at the VBA code behind it (I do this as a matter of course in case I see anything interesting, sad I know...) and lo and behold a function called LegalFilename()

 

Nothing special about that and nothing out of the ordinary, apart from the fact the code matches the code for the version of this function I wrote, letter for letter, even down to the variable names!

 

My version:

Public Function LegalFilename(fName As String, replacement As String) As String
Dim IllegalCharacters As String
IllegalCharacters = "?[]/\=+<>:;"",*"
LegalFilename = fName
For x = 1 To Len(IllegalCharacters)
   LegalFilename = Replace(LegalFilename, Mid$(IllegalCharacters, x, 1), replacement)
Next x
End Function

 

kerboodle! version:

Public Function LegalFilename(fName As String, replacement As String) As String
Dim IllegalCharacters As String
IllegalCharacters = "?[]/\=+<>:;"",*"
LegalFilename = fName
For x = 1 To Len(IllegalCharacters)
   LegalFilename = Replace(LegalFilename, Mid$(IllegalCharacters, x, 1), replacement)
Next x
End Function

 

What are the chances of that?!

 

EDIT:

Wow, I really wish I hadn't posted that, I weren't looking at the code for kerboodle! sheet at all, I was looking at another module within my own code... I knew I should have stayed in bed this morning... :getmecoat:

Edited by LosOjos
Posted
Have a biiiiig mug of , and I'm sure you'll be alright!

 

I'm taking that as medical advice, I'll be sure to indulge at the John Mayer gig tonight!

Posted
Shock! Horror! Own code matches own code!:troll:

 

Have a biiiiig mug of , and I'm sure you'll be alright!

 

at present i cud do with an alcoholic beverage - namely a hot toddy - darn cold! *runs for another tisue*

 

edit: sneeze!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...