Hello everyone from A.Maurizio
My new problem is this:
Using two userforms I created a routine where in the first Userform I can extract the names of the TXT files that are in my working subfolder called with different names and set inside a listbox.
And so far everything is ok.
While in the second userform I inserted a textbox where it should retrieve the file name minus the final extension which in this case is (TXT)
Now the problem is this:
To remove the final extension of each filename such as:
A file called it (File1) Besides another file called it (2 ° _Data) I used the "Left" function Writing it like this:
Res = Left (userform2.Textbox1.text & "", 5)
Userform2.textbox1.text = res & Userform1.listbox1.text
Ora sw io adottatti solo questa formula per ottenere la sola scritta (File1) srebbe finita qui!
in quanto left (5) toglie le ultime lettere dell'entensione del file "Fili1.Txt"
Però se io volessi etrarre usando la stessa modalità il nome del file (2°_Data.Txt) in modo che risulti soltanto la scritta (2°_Data) dovrei sempre manualmente scrivere la formula "Left(7)"
Now my question is this:
There would be no way to extract the filenames minus the final extension; Without using inputbox etc ...!
I had also tried to divide the various functions by modules and then groped to call them using a sort of Select Case i If Then Elseif but it makes Water everywhere.
Therefore you have an idea how I can go about solving this problem. That's all. Thanks
Greetings from A.Maurizio
To strip off everything after the last period, you can use Instrrev:
Left$(UserForm1.TextBox1.Text & "", Instrrev(UserForm1.TextBox1.Text, ".") - 1)
Tenta questa soluzione
Default = Left(UserForm1.TextBox1.Text, InStrRev(UserForm1.TextBox1, ".") - 1)
Hello Velouria and Hans Hallebeek
You are both fantastic
I tried your help right away and it works wonders.
Done this way, I have to be honest, I probably never would have gotten there.
Thank you so much you are both fantastic
Greetings and good luck to all from A.Maurizio