ross
February 24th, 2000, 11:08 AM
Could someone write some code that maps a network drive. This is tricky part. Write it as sammal as you can, no error control even. I'm trying to learn it starting simple. Thanks for any help
|
Click to See Complete Forum and Search --> : Mapping a drive ross February 24th, 2000, 11:08 AM Could someone write some code that maps a network drive. This is tricky part. Write it as sammal as you can, no error control even. I'm trying to learn it starting simple. Thanks for any help Kyle Burns February 24th, 2000, 11:26 AM You need to use the WNetAddConnection function for this. 'Declare the API call Declare Function WNetAddConnection Lib "mpr.dll" Alias _ "WNetAddConnectionA" (byval lpszNetPath as string, _ byval lpszPassword as string, byval lpszLocalName _ as string) as Long 'Now We can use it somewhere sShare = "//MyServer/MyShare" sPwd = vbNullString sDriveLetter = "X:" lngResult = WNetAddConnection(sShare, sPwd, sDriveLetter) ross February 24th, 2000, 11:48 AM I'm not sure where to put all the code. do i put all of it in a new module. what part do i put in a command button Kyle Burns February 24th, 2000, 11:55 AM Put the Declare statement in a standard module (be sure to place the keyword Public before it). Declares can only be placed in standard modules. The other code you can put wherever you like (e.g. Command1_Click()). codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |