Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

¿Cómo detener un macro en bucle al cerrar Excel?

publicado

Hola soy nuevo en la programación en vba, tengo un libro compartido en el que al abrirlo se auto ejecuta un macro que hace que el libro se guarde a los 10 mins. de haberlo abierto, este se ejecuta como bucle. Pero tengo un problema, y es que a pesar de que yo cierre el libro de excel, este se vuelve a abrir y ejecutar el macro. Quise usar la opción "Exit Sub" pero no supe cómo programarlo, agradeceré mucho su apoyo. Mis macros para efectuar la tarea son los siguientes:

Sub Auto_Open()
  Hora = Now + TimeValue("00:10:00")
  Application.OnTime Hora, "Guardar"
 End Sub

 

Sub guardar()
ThisWorkbook.Save
Auto_Open
End Sub
 

Featured Replies

publicado

prueba cambiando tus códigos a la siguiente estructura (todo en el mismo módulo):

Dim siguiente As Date
Const tiempo As String = "0:10:00"

Sub Auto_Open()
  guardar
End Sub
Sub Auto_Close()
  detener
End Sub

Sub guardar()
  siguiente = Now + TimeValue(tiempo)
  ThisWorkbook.Save
  Application.OnTime Siguiente, "guardar"
End Sub
Sub detener(): On Error Resume Next
  Application.OnTime siguiente, "guardar", Schedule:=False
End Sub

 

publicado
  • Autor

Muchas gracias, me funcionó a la perfección

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.