Hi
I would like some code that will display the name of a .txt file in a specific folder in a message box. Also to make it not to display the .txt format extension.
Is this possible please?
Thanks
Z

Hi
I would like some code that will display the name of a .txt file in a specific folder in a message box. Also to make it not to display the .txt format extension.
Is this possible please?
Thanks
Z
Everything's possible :-)
Not quite sure what you're trying to do (which file? where?) but this might help:
it steps through all the files in the folder. For each, it gets the full name (ofile.path) and then uses the getextensioname method to get the extension. If this is txt then it uses a message box to pop up the base part of the name (eg c:\temp\steve_file.txt will pop up steve_file)Code:set ofso=createobject("scripting.filesystemobject") set oFolder=ofso.getfolder("c:\temp") for each oFile in oFolder.files if lcase(ofso.getextensionname(oFile.path))= "txt" then msgbox ofso.getbasename(oFile.path) end if next

Just the job, cheers
Have you got a script that will tidy my roomEverything's possible![]()

Just one question how would i get more text in there please? I would like a phrase just before it displays the file name.
Thanks

Code:set ofso=createobject("scripting.filesystemobject") set oFolder=ofso.getfolder("c:\temp") for each oFile in oFolder.files if lcase(ofso.getextensionname(oFile.path))= "txt" then msgbox "Tonight Matthew, the file name is: " & ofso.getbasename(oFile.path) end if next

Very Cheesy!
Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)