Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

map to users drive/document and open 1

Status
Not open for further replies.

itsteapot

Technical User
Mar 27, 2009
49
GB
Is it possible to map to a users My Documents then to a spreadsheet and open it?
I have a script which uses an input box to collect the user name and add it to the file path. i would like to have the speadsheet added to this then for it to open.

part of my code below (with many thanks from Mark and others)



Sub MapDrives
On Error Resume Next
Dim UserString, UserPassword, WSHNetwork
UserString = login.Value
UserPassword = password.Value

Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.MapNetworkDrive "P:", "\\bilbo\users\" & UserString,True, UserString,UserPassword
 
if you already have the task of mapping a drive working and completed then dont even think / worry about changing it.
treat your two new requirements as totally seperate tasks. That way you get some reusability and extraction. so, condiser adding two new functions / subs, one for adding a file, the other for opening a file? or really starting a thread/process?

Function CopyFile(ByVal strSource, ByVal strDestination)
'does the strSource exist?
'does the string destination exist?
'do you want to override a newer file?
etc

End Function
 
MrMovie -
That's the kind of response I would look for if I had the same question. It puts milestones along a goals path. I commend you!

itsteapot -
Perhaps not an element of your environment now, but be mindful that group policy objects could trump what you script defines.

-Geates
 
Hi thanks Guys, I am rolling this out with a Group policy designed to allow the implementation of my script, the script will run on machines that have their own GPolicy (to control the user) and will auto logon to a user in that environment. The script will connect the user to the Gpolicy at the server level. (Tested and it works) I now have a method that allows the machine to be logged on all the time with programs all loaded and the script allows a very quick change of user. Perfect in our school where the computers are hot seated often 3 or 4 times an hour by different users.
 
thanks Geates, you must have known it was my birthday yesterday :)
 
itsteapot, the school classroom is an interesting IT environment. check out Research Machines, they may be a good resource for tools etc
 
Happy belated birthday mrmovie! Thanks for the info too
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top