MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
On Error Resume Next Dim fso, folder, NewsFile,sFolder, files Dim counter Dim filenames() Set fso = CreateObject("Scripting.FileSystemObject") sFolder = "c:\test" If sFolder = "" Then Wscript.Echo "No Folder parameter was passed" Wscript.Quit End If 'Set NewFile = fso.CreateTextFile(sFolder&"\FileList.txt", True) Set folder = fso.GetFolder(sFolder) Set files = folder.Files counter = 0 ' load requests into array For each textfile In files ReDim Preserve filenames(counter) filenames(counter) = textfile.Name counter = counter + 1 Next ' build & display msgbox text for current requests Dim strMsgboxtext strMsgboxtext = "There are " & counter & " requests to process. Please click OK to continue." & vbcrlf for i = 0 to counter strMsgboxtext = strMsgboxtext & vbcrlf & filenames(i) next msgbox(strMsgboxtext) 'msgbox "There are " & counter & " requests to process. Please click OK to continue." Set objFSO = CreateObject("Scripting.FileSystemObject") for j = 0 to counter msgbox("Please click OK to process request #" & counter & ": " & filenames(counter)) ' read information from current request Set objFile = objFSO.OpenTextFile("c:\test\" & filenames(j), ForReading) Const ForReading = 1 ' dim array to store contents of current request Dim arrFileLines() ' load contents of current request into array k = 0 Do Until objFile.AtEndOfStream Redim Preserve arrFileLines(k) arrFileLines(k) = objFile.ReadLine k = k + 1 Loop objFile.Close ' init msgbox text to display contents of current request Dim strMsgboxtext2 strMsgboxtext2 = "displaying contents of request #" & j+1 & ": " & vbcrlf & vbcrlf ' build msgbox text to display contents of current request (k = number of lines in request) For l = 0 to k strMsgboxtext2 = strMsgboxtext2 & arrFileLines(l) & vbcrlf Next ' show contents of current request msgbox(strMsgboxtext2) Next ' call next script Set WSHShell = CreateObject("WScript.Shell") WSHShell.Run "wscript c:\users\administrator\desktop\test.vbs", , True ' indicate script is complete msgbox("script complete") 'NewFile.Close
|Everything left of comma in excel||4||48|
|excel VBA - clear duplicates not working||11||40|
|Powershell script to compare two directory content difference only ?||5||53|
|adding "ungroup sheets" to existing vbs code||5||52|