Map Network Drive FAO Gary's Student

L

leerem

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
 
G

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.
 
L

leerem

Hi Gary,
to give you the full picture, I have code that looks into at present 12
sites around the country, it locates a file, downloads this file, checks it,
and then saves it to my PC in a specific folder for each site for furthur
analysis. Once all the sites have been downloaded and saves it consolidates
all the files and produces national league tables, which are then used for
furthur analysis.

New sites are being added as the project expands. At present I manually have
to Map all the drives at the beginning of the day so that the code works for
each individully assigned drive letter. Sooner or later i will run out of
drive letters.
How can I, at the begining of each sub eg Sub bft() map the driver letter
"B" to this site which will then enable me to download the specific data as
long as the PC is switched on of course and upon completion disconnect /
delete th Map and then re-assign the same drive letter to another site on the
next Sub eg Sub Doncastor()

This will ensure I don't run out of drive letters and can add as many sites
as required.

To create the .bat file is this as Quesion 1 in my previous corrospondance

many thanks in anticipation for you patience in this matter
Lee
 
G

Gary''s Student

Under these circumstances, I suggest not using an assigned drive, rather use
the URL directly.
 
L

leerem

How do you use the URL: I dont know how this would help. I can use the VNC
but i dont want to go down that avenue.

Regards
Lee
 

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