Aquí muestro el código que utilizo para abandonar la aplicación.
Y Casi siempre me muestra la ventanita de VBAProyect Contraseña.
Si la introduzco se cierra y si no me la sigue pidiento unas cinco
veces, hasta que se cierra.
' BOTON del MENU PRINCIPAL
Private Sub CommandButton10_Click()
Unload MENU_PRINCIPAL
Cerrar_Libro
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim TuCondicionDeSalida As Boolean
If SALIDA = True Then
ElseIf Sheets("Acerca de").Range("IU45") < 1 Then
If TuCondicionDeSalida = False Then
Cancel = True
Else
Cancel = False
End If
End If
End Sub
Sub Cerrar_Libro()
Dim respuestas As Integer
Dim SALIDA As Boolean
'On Error Resume Next
Application.StatusBar = False
If SALIDA = False Then
respuestas = MsgBox(" Deseas guardar los cambios efectuados en '
xxxx.xls ", vbYesNo, Title:="Pregunta ")
If respuestas = vbYes Then
Restablece_Teclas
Application.Visible = False
Muestra_Entorno
Application.StatusBar = False
CommandBars("toolbar list").Enabled = True
Libros_xls
ThisWorkbook.Close SAVECHANGES:=True
Application.Quit
Else
Restablece_Teclas
Application.Visible = False
Muestra_Entorno
Application.StatusBar = False
CommandBars("toolbar list").Enabled = True
Libros_xls
ThisWorkbook.Close SAVECHANGES:=False
Application.Quit
End If
Else
Restablece_Teclas
Application.Visible = False
Muestra_Entorno
Application.StatusBar = False
CommandBars("toolbar list").Enabled = True
Libros_xls
ThisWorkbook.Close SAVECHANGES:=False
Application.Quit
End If
End Sub
Sub Libros_xls()
Application.IgnoreRemoteRequests = False
End Sub
Sub Restablece_Teclas()
Application.OnKey "^{C}"
Application.OnKey "^{AVPAG}"
Application.OnKey "^{REPAG}"
Application.OnKey "^%{DEL}"
Application.OnKey "%+M"
Application.OnKey "%+O"
Application.OnKey "^+p"
Application.OnKey "{F2}"
Application.OnKey "{F3}"
Application.OnKey "{F4}"
Application.OnKey "{F5}"
Application.OnKey "{F6}"
Application.OnKey "{F7}"
Application.OnKey "{F8}"
Application.OnKey "{F9}"
Application.OnKey "{F10}"
Application.OnKey "{F11}"
Application.OnKey "{F12}"
Application.OnKey "^{F12}"
Application.OnKey "^{F11}"
Application.OnKey "^{F10}"
Application.OnKey "^{F9}"
Application.OnKey "^{F8}"
Application.OnKey "^{F5}"
Application.OnKey "^{F4}"
Application.OnKey "%{F8}"
Application.OnKey "%{F4}"
Application.OnKey "%{F2}"
Application.OnKey "%{F1}"
Application.OnKey "^u"
Application.OnKey "^a"
Application.OnKey "%{F11}"
Application.OnKey "%{F12}"
Application.OnKey "+{F11}"
Application.OnKey "+{F12}"
End Sub
Sub Muestra_Entorno()
Sheets("Acerca de").Range("IU45") = 1: Sheets("Acerca
de").Range("IU47") = ""
Mostrar_Menus
EntornoNormal True
End Sub
Sub EntornoNormal(ByVal Mostrar As Boolean)
On Error Resume Next
Application.CommandBars("Formatting").Visible = Mostrar
Application.CommandBars("Standard").Visible = Mostrar
Application.CommandBars.ActiveMenuBar.Enabled = Mostrar
Application.CommandBars.ActiveMenuBar.Visible = Mostrar
With Application
' .ShowStartupDialog = Mostrar
.DisplayFormulaBar = True
.DisplayStatusBar = True
.ShowWindowsInTaskbar = Mostrar
End With
End Sub
Espero que alguien pueda ver de donde viene mi problema, de que cuando
creo
que ya se ha cerrado la aplicación por completo me salta la ventanita
de VBAProyect contraseña.
Leer las respuestas