Code Doesn't Run in TS

S

-Steve-

I have a macro that runs fine on local workstations, but fails if run in
terminal services. Here is the code:

Sub test()
With Application.FileSearch
.LookIn = "s:\cms\"
.Filename = "*.*"
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
End With
End Sub

When run on the workstation it returns a list of files in the directory.
When run in Terminal Services it always says there's zero files.
 
T

TC

Just a total guess, but, does TS create a seperate virtual environment
for each user, different to the normal local environment on the PC?
IOW, is the same code actually looking in a different place when you
run it from TS?

Here's what I'd do. Temporarily mod the code to /create/ a
weirdly-named file in that folder. Then run it from TS & see where that
file was actually created. Presumeably that will also be the folder
were it is actually looking.

HTH,
TC
 
C

Chris Lavender

What happens if you use the full network path name rather than a drive
letter? ie LookIn=\\servername\drivename\

Best rgds
Chris lav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top