View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
IXLINXL IXLINXL is offline
external usenet poster
 
Posts: 7
Default VBA to Reference a file when not logged in? unc address?

Hi all. I am using the Office 2000 package and I hav created some nifty
macros (With help from some of you wizards of course) But I am having
problems makeing them work while logged off.

wkbk A needs to access wkbk B and currently I am referencig it with code
something like this:

FilePath = "X:\folder1\Customer"

'change drive to FilePath
ChDrive FilePath

'change directory to FilePath
ChDir FilePath

DataDir = Dir("wkbk_B.xls")

'If the file does not exist then go to exitline
If Len(DataDir) = 0 Then GoTo exitline

CustDir = Dir("wkbk_C.xls")
'If the file does not exist then..
If Len(CustDir) = 0 Then GoTo exitline

This works fine when I am logged in but when I set up the task scheduler to
run this I am not logged in and it fails. I am pretty sure it is failing
because the "X" drive is not mapped while I am not logged in.

I have tried using the UNC address in place of the drive association but it
does not work.

Any other suggestions how I might reference and open file wkbk_B.xls ??

IXLINXL - not