Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Ted Collins   on Feb 03 In MS Office Category.

  
Question Answered By: Mercedes Andrews   on Feb 03

To check if a drive is on the network  you can use the DriveType
property (3 for network) of the drive object along the following lines.

Sub ShowDriveList()
Dim objDrive As Object
Dim msg As String
For Each objDrive In CreateObject
("Scripting.FileSystemObject").Drives
Select Case objDrive.DriveType
Case 0: msg = msg & vbNewLine & objDrive.DriveLetter & ":
Unknown"
Case 1: msg = msg & vbNewLine & objDrive.DriveLetter & ":
Removable Drive"
Case 2: msg = msg & vbNewLine & objDrive.DriveLetter & ":
Hard Disk Drive"
Case 3: msg = msg & vbNewLine & objDrive.DriveLetter & ":
Net work  Drive"
Case 4: msg = msg & vbNewLine & objDrive.DriveLetter & ":
CD-ROM Drive"
Case 5: msg = msg & vbNewLine & objDrive.DriveLetter & ":
RAM Disk Drive"
End Select
Next
MsgBox msg
End Sub

To restrict usage, you could use the Workbook_Open event to check the
drive type and if not = 3, close the file with "Network Only...."
message.

Share: 

 

This Question has 27 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Restrict workbook to network Or get search suggestion and latest updates.


Tagged: