If (osVer = "Windows Vista") Then
' test write access
On Error GoTo errorWrite
Dim FileNum As Integer
OrigPath = ActiveWorkbook.path
fileNm = "writeAccess.tst"
FullFileName = OrigPath & "\" & fileNm
LogMessage = "test write marker..."
FileNum = FreeFile ' next file number
Open FullFileName For Append As #FileNum ' creates the file if it doesn't exist
Print #FileNum, LogMessage ' write information at the end of the text file
Close #FileNum ' close the file
GoTo noError
errorWrite:
result = MsgBox("**** Windows Vista has been detected ****." _
& vbCrLf & "Please relaunch this program." _
& vbCrLf & "Right-click on the program icon and select 'Run As Administrator'.", vbOKOnly)
' just QUIT - can't really do anything with Vista at this point
GoTo AppQuit
noError:
' remove the test write access file
Kill (FullFileName)
End If
Bookmarks