ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exit when its a Mac (https://www.excelbanter.com/excel-programming/311082-exit-when-its-mac.html)

jose luis

Exit when its a Mac
 
Hello, EveryBody. I been developing and application to run in the PC. I 'm
still working to run it in the Mac, but at this moment i would like to
prevent the users to try to run it in the Mac. The app already recognizes
when the PC is a Mac. Then I would like to close the application. Here is
what i wrote but still don't works. Could you give a hint on how to overcome
this situation? I think an instruction to leave the subroutine will be handy.
I already tried ThisWoorkBook.Close, the problem "remains the same"

Thanks in advace.

Private Sub Workbook_Open()
Dim AddInTitle As String, Msg As String

#If Mac Then "Here checks if the System is Mac"
MsgBox "Aplicación para Windows (97 en adelante). Estamos trabajando en la
versión para Mac. Gracias por su comprensión."
Application.DisplayAlerts = False
ThisWorkbook.Close "In here doesn't close!
Application.DisplayAlerts = True
Exit Sub
#End If

If Not ValidaSeguridad Then "Here validates a Code that i give the user
SaveSetting "TestNT", "Config", "Serie", ""
MsgBox "Solicite su Password etc., etc."
RegistroCodigo
If Not ValidaSeguridad Then "If the code is not good leaves the worksheet"
ThisWorkbook.Saved = True
Application.DisplayAlerts = False
ThisWorkbook.Close
Application.DisplayAlerts = True
Exit Sub
End If
Else
End If

If ValidaSeguridad Then "If the Code is Ok Procedes with the app
Application.ScreenUpdating = False
ThisWorkbook.Sheets(1).Activate
ThisWorkbook.Sheets(1).Range("A1").Select

On Error Resume Next
'-4105 xlAutomatic, -4135 xlManual
If Application.Calculation = -4135 Then
Application.Calculation = xlAutomatic
End If

Application.ScreenUpdating = True
On Error GoTo 0
MaximizaVentana

End If
End Sub






All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com