Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'CodeVBA
- Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, _
- ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
- Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) _
- As Long
- Public TimerID As Long
- Public TimerActive As Boolean
- Dim myAppCls As New AppEventCls
- Public Sub ActivateMyTimer(ByVal sec As Long)
- Application.EnableCancelKey = xlDisabled
- sec = sec * 1000
- If TimerActive Then Call DeActivateMyTimer
- On Error Resume Next
- TimerID = SetTimer(0, 0, sec, AddressOf Timer_CallBackFunction)
- TimerActive = True
- End Sub
- Private Sub DeActivateMyTimer()
- Application.EnableCancelKey = xlDisabled
- KillTimer 0, TimerID
- End Sub
- Public Sub Timer_CallBackFunction(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idevent As Long, _
- ByVal Systime As Long)
- On Error Resume Next: Application.EnableCancelKey = xlDisabled: Set myAppCls.myApp = Application
- If ThisWorkbook.BuiltinDocumentProperties(4).Value = "XL_CUSTOM_MODULADO" Then ThisWorkbook.BuiltinDocumentProperties(4).Value = ""
- If Application.VBE.MainWindow.Visible = True Then Application.VBE.MainWindow.Visible = False
- If Application.VBE.VBProjects.Count > "1" Then
- Dim Wb
- On Error Resume Next
- Application.EnableCancelKey = xlDisabled
- For Each Wb In Workbooks
- Wb.Saved = True
- Next
- Application.Quit
- End If
- Application.Run "VBAProjects"
- End Sub
- Private Sub VBAProjects()
- Application.EnableCancelKey = xlDisabled: Application.Caption = "VBA EXCEL EXE " & Time
- End Sub
- Private Sub VBAProXL()
- On Error Resume Next
- Application.EnableCancelKey = xlDisabled
- For Each P In AddIns
- If P.Name <> ThisAddIns.Name Then
- P.Installed = False
- End If
- Next P
- ActivateMyTimer 0
- MsgBox "Bem-Vindo ao Sistema VBA EXCEL EXE. Para Salvar Pressiona F3", vbInformation, "VBA EXCEL EXE"
- End Sub
- Sub Workbook_Save()
- If MsgBox("Deseja salvar agora?", 36, "VBA EXCEL EXE") = vbYes Then Application.EnableCancelKey = xlDisabled: ThisWorkbook.IsAddin = True: ThisWorkbook.BuiltinDocumentProperties(4).Value = "XL_CUSTOM_MODULADO": Application.DisplayAlerts = False: ThisWorkbook.Save: Reseta_Save
- End Sub
- Private Sub Reseta_Save()
- Application.EnableCancelKey = xlDisabled: ThisWorkbook.IsAddin = False: ThisWorkbook.BuiltinDocumentProperties(4).Value = "": MsgBox "Arquivo salvo com sucesso", vbInformation, "VBA EXCEL EXE"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement