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.

Como Aabrir Macro en VBA desde Visaual Basic?

publicado

Que tal,

Hago este tema porque tengo una duda que me gustaría y me ayudarán a resolver. Me gustaría saber si desde un boton de un formulario en Visual Basic 6.0, es posible abrir una macro en VBA creada en Excel 2010. Si es posible, me gustaría saber cuál es el código que necesito.

Muchas gracias por su atención.

Featured Replies

publicado

No tengo Visual Basic 6, pero no deberías tener problemas:

En el código del botón en VB6 incluye la creación de la instancia a Excel:


Dim xl As New Excel.Application
Dim xlsheet As Excel.Worksheet

xl.Workbooks.Open ([COLOR=#0000cd][I][B]"C:\MiLibroConLaMacro.xls"[/B][/I][/COLOR])
xl.ActiveWorkbook.Close [I][COLOR=#0000cd][[/COLOR][/I][B][I][COLOR=#0000cd]False/True][/COLOR][/I] [COLOR=#008000]'(False [/COLOR][/B][COLOR=#008000]no salva cambios[/COLOR][B][COLOR=#008000]/True [/COLOR][/B][COLOR=#008000]salva cambios[/COLOR][B][COLOR=#008000])[/COLOR][/B]
xl.Quit

Set xl = Nothing
[/CODE]

y en el archivo [i][b]Excel[/b][/i], en el módulo [i][b]ThisWorkbook[/b][/i], pon la llamada a la macro que quieras ejecutar.

No te olvides incluir en tu proyecto VB6 la referencia de Excel:

[color=#008000][i][b]Microsoft Excel 14.0 Object Library [/b][/i][/color]

publicado
  • Autor

Muchas gracias Macro Antonio por tu respuesta. Cierro mi tema.

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.