Sub Auto_Open()
Dim mb As VbMsgBoxResult
'If Environ("username") = "sasurpa" Then
mb = MsgBox("Shall I quit?", vbYesNo)
If mb = vbYes Then
Exit Sub
End If
'End If
Install_Wizard
End Sub
Function get_ANY_drive(ByVal lstrDrive_To_Get As String) As String
Dim thisFileObj, allDrivesObj
Dim item
Dim lintSlash_Location As Integer
Dim mb As VbMsgBoxResult
Dim lboolFlag As Boolean
Dim lstrRoot As String
Set thisFileObj = CreateObject("Scripting.FileSystemObject")
Set allDrivesObj = thisFileObj.Drives
lboolFlag = False
For Each item In allDrivesObj
Select Case item.driveletter
Case lstrDrive_To_Get
lboolFlag = True
lstrRoot = item.sharename
lintSlash_Location = InStr(3, lstrRoot, "\")
lstrRoot = Left(lstrRoot, lintSlash_Location - 1)
get_ANY_drive = lstrRoot
End Select
' Select Case item.DriveType
' Case 0: oneDriveType = " [ Unknown ] "
' Case 1: oneDriveType = " [ Removable ]"
' Case 2: oneDriveType = " [ Fixed ] "
' Case 3: oneDriveType = " [ Network ] "
' Case 4: oneDriveType = " [ CD-ROM ] "
' Case 5: oneDriveType = " [ RAM Disk ] "
' End Select
Next item
If lboolFlag = False Then
mb = MsgBox("Please close Excel, map the " & lstrDrive_To_Get & ": drive, then restart Excel.", , lstrDrive_To_Get & ": Drive Not Mapped")
get_ANY_drive = "False"
End If
Set thisFileObj = Nothing
Set allDrivesObj = Nothing
End Function
Sub Install_Wizard()
Dim nms() As String
Dim vers() As String
Dim mb As VbMsgBoxResult
Dim root_V As String
On Error Resume Next
root_V = TurnBack_Distributor.get_ANY_drive("V")
If root_V = "False" Then
Exit Sub
End If
pth1 = Environ("APPDATA") & "\Microsoft\AddIns"
pth2 = root_V & "\private\sasurpa"
mb = MsgBox("I am about to install Paul Sasur's Turnback Wizard." & vbCrLf & "Proceed?", vbYesNo, "Install")
If mb = vbNo Then
Exit Sub
Else
AddIns.Add pth2 & "\TurnBacks.xla", True
AddIns("Paul Sasur's TurnBack Wizard").Installed = True
End If
ThisWorkbook.Close
End Sub