Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a simple script

Status
Not open for further replies.

getme001

Vendor
Aug 21, 2014
5
US
Hello everyone,
Hoping someone will help me here. I have a script that asks for a directory and a subdirectory name. I need the script to go to the directory and then open the subdirectory entered but somehow I cannot get it to work. Here's what I have:


CONST strDir = "c:\test"

set objShell = CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")

function findFolder(strDir, strFlag1)
set objFolder = objFSO.GetFolder(strDir)
for each objSubFolder in objFolder.SubFolders
if (inStr(objSubFolder.Name, strFlag1)) then
findFolder = objSubFolder.Path
exit function
else
findFolder = findFolder (objSubFolder.Path, strFlag1)
end if
next
end function


strFlag1 = inputBox("Enter Client")
strFlag2 = inputBox("Enter case")
strWeb = findFolder(strDir, strFlag1) & "\strflag2"
objShell.Run strWeb

 
Check out Link
There is frankly a bunch of weird things in your example.
You can't use .run the way you are to call a function.
findFolder(strDir, strFlag1) & "\strflag2"
How does strflag2 come into play at all?
 
Anyway, I'd repce this:
strWeb = findFolder(strDir, strFlag1) & "\strflag2"
with this:
strWeb = findFolder(strDir, strFlag1) & "\" & strflag2

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you for the responses. That did the trick. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top