|
-
February 24th, 2000, 12:08 PM
#1
Mapping a drive
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
-
February 24th, 2000, 12:26 PM
#2
Re: Mapping a drive
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)
-
February 24th, 2000, 12:48 PM
#3
Re: Mapping a drive
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
-
February 24th, 2000, 12:55 PM
#4
Re: Mapping a drive
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()).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|