View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Map Network Drive FAO Gary's Student

Hi Lee:

In this case, I suggest creating an external file - leerem.bat that would
reside somewhere on your local hard-drive.

Ideally, one it has been executed by a user, the D drive should be assigned
and will be re-assigned each time the user boots up or logs on.

Execute the file by double-clicking the icon.

It is possible to execute the file from Excel with a Shell statement in a
VBA macro.

However, in this case, we want the drive to be assigned BEFORE Excel is
started.
--
Gary''s Student - gsnu200826


"leerem" wrote:

Hi,
many thanks for the peice of code as below:

net use d:/delete/y
net use d:"\bft-123456w\d$"/PERSISTENT:yes
pause

wherby d:/ is the Drive letter for the Belfast PC?

without coming over as thick... you said create a file called leerem.bat
containing the code above and then execute the .bat file

Question 1:
Do you mean create an excel file and write the code in the open workbook
section and then save the file as leerem with a .bat extension?

Question 2:
To execute this .bat file would I write the code as follows;

Sub bft()
dim Y as variant ' would variant be correct?
Y=shell(cmd.exe /d D:\leerem.bat",1)

more code

net use d:delete/y ' to disconnect the drive

End sub

Regards
Lee