View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Little Penny[_3_] Little Penny[_3_] is offline
external usenet poster
 
Posts: 48
Default Log-In Credentials in a Macro

I have an excel macro that accesses files on another computer over the
network (workgroup). I have shared this folder however when I run the
macro unless I access the other computer and enter the log in
credentials. Is there a way to hard code the log in credentials into
my code, so that it's not necessary to login if the computer is
restarted or another account logs on?

What I currently do now is goto Start=Run \\10.0.118.16 and enter the
credentials before I run the macro.

Below is a snap shot of the code that accesses the other computer







Set Res = Range("A1") 'upper left corner of Result range

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("\\10.0.118.16\DataFiles\")
Set fc = f.Files

i = 0

With Res

For Each fl In fc

If UCase(Right(fl.Path, 4)) = ".TXT" Then


Thanks


Little Penny