Thread: File Path
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default File Path

Kevin Smith wrote...
You can use Environ("UserName").

Change you code from ...

Workbooks.Open Filename:= _
* * * * "C:\Documents and Settings\ksmit40\Desktop\IDCplan.xls"

To...

Workbooks.Open Filename:= _
* * * * "C:\Documents and Settings\" & _
Environ("UserName") & "\Desktop\IDCplan.xls"

....

Better to use Environ("USERPROFILE") which gives the full profile
directory path and won't need to be changed when/if OP's users upgrade
to Windows Vista or 7 where profiles are stored under C:\Users rather
than C:\Documents and Settings.