Saltar al contenido
PROGRAMAR EN VBA MACROS DE EXCEL

Como HACER COMPATIBLE MACROS en OFFICE de 32 y 64 BITS #335

Compatibilidad office 32 y 64 bits

Compatibilidad entre Macros de 32 y 64 Bits

En varios foros es una pregunta común, como hacer compatibles macros en office de 32 y 64 bits, en este post muestro como se puede hacer en forma fácil que las macros sean compatible en Office tanto de 32 como de 64 bits.

Aprende a manejar Excel en forma eficaz, click acá, si quieres aprender sobre Excel en inglés, entonces debes hacer click here. Si lo que necesitas es aprender o profundizar sobre la programación de macros con VBA este es unos de los mejores cursos on line que he visto en internet, te lo recomiendo no te arrepentirás.

  
 

Mira el funcionamiento de la macro y una explicación más detallada de su codificación y funcionamiento, recomiendo observar para una más fácil comprensión de la macro; suscribe a nuestro canal de You Tube, mira el playlist con  vídeos relacionados donde podrás ver la macros relacionadas en acción con una explicación en forma visual que ayudará a entender el ejemplo en forma más fácil.

 

Código que permite compatibilizar versiones de 32 y 64 bits de Office 

El código es un poco complicado de explicar hasta innecesario creo, solo basta decir que lo que se hace es detectar si se esta usando Office de 32 bits usa unas variables y si se está usando Office de 64 bits usa otras variables compatibles con esta versión.

Básicamente la diferencia está en la declaración de variables una por ejemplo, es la variable tipo «long», en 64 bits la variable es  «LongPtr» y en 32 bits es «Long».

Si se copia y pega el código que tiene el libro de ejemplo en un módulo prácticamente está asegurada la compatibilidad entre las versiones de Office de 32 y 64  bits, ya que incluye la mayoría de las variables que generan problemas de incompatibilidad.

Si se desea saber más sobre el tema de compatibilidad les dejo un link a la ayuda de Microsoft donde explica sobre la compatibilidad de entre las versiones de 32 y 64 bits de Office.

Descarga del archivo ejemplo llamado como hacer compatibles macros en Office de 32 y 64 bits

Descarga el Libro de Excel con el código completo que te ayudará a compatibilizar macros entre 32 y 64 bits desde el final del post, solicito aportar para sostener esta web, si está dentro de tus posibilidades, desde ya muchas gracias.

Código del ejemplo Como Hacer Compatibles Macros de Excel en Office de 32 bits y 64 bits

Código que se ingresa en módulo

#If VBA7 And Win64 Then
‘Si es de 64 bits
Public Declare PtrSafe Function ShellExecute Lib «shell32.dll» Alias «ShellExecuteA» (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
Public Declare PtrSafe Function FindWindow Lib «USER32» Alias «FindWindowA» (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Public Declare PtrSafe Function GetWindowLongPtr Lib «USER32» Alias «GetWindowLongPtrA» (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtr
Public Declare PtrSafe Function SetWindowLongPtr Lib «USER32» Alias «SetWindowLongPtrA» (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
Public Declare PtrSafe Function DrawMenuBar Lib «USER32» (ByVal hwnd As Long) As LongPtr
Public Declare PtrSafe Function RegOpenKeyA Lib «advapire32.dll» (ByVal hKey As LongPtr, ByVal lpSubKey As String, phkResult As LongPtr) As LongPtr
#Else
‘Si es de 32 bits
Public Declare Function ShellExecute Lib «shell32.dll» Alias «ShellExecuteA» (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Declare Function FindWindow Lib «USER32» Alias «FindWindowA» (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowLong Lib «USER32» Alias «GetWindowLongA» (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib «USER32» Alias «SetWindowLongA» (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function DrawMenuBar Lib «USER32» (ByVal hwnd As Long) As Long
Public Declare Function RegOpenKeyA Lib «advapire32.dll» (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
#End If

Sub muestramsgbox()
MsgBox («Agregando estos códigos las macros se ejecutan indistintamente en Excel con 32 o 64 bits»), vbInformation, «AVISO»
End Sub



Si te fue de utilidad puedes INVITARME UN CAFÉ y de esta manera ayudar a seguir manteniendo la página, CLICK para descargar en ejemplo en forma gratuita.

If this post was helpful INVITE ME A COFFEE and so help keep up the page, CLICK to download free example.

Donate:
Cuenta Paypal: https://paypal.me/programarexcel
Cuenta Bitcoin: 1KBGGb8fyDzyR3X1Rie6m7VguzaAfngNbd
Cuenta Ether: 0x41Bbd24556914C83a31217eBb3BC49789b66e407

Summary
Author Rating
1star1star1star1star1star
Aggregate Rating
no rating based on 0 votes

Entradas relacionadas

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Comentarios (13)

como estas amigo, buen dia.

me sucede lo mismo pero con las versiones de office 2011 de 32 bits en MAC vs el office 2019 de 64 bits
en MAC, te agradecería mucho si me puedes colaborar con este problema.

Responder

I’m the business owner of JustCBD label (justcbdstore.com) and I’m presently aiming to grow my wholesale side of company. It would be great if someone at targetdomain can help me 🙂 I considered that the most effective way to accomplish this would be to talk to vape companies and cbd retailers. I was hoping if someone could suggest a dependable web-site where I can get CBD Shops B2B Database with Emails I am currently reviewing creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Unsure which one would be the most suitable selection and would appreciate any assistance on this. Or would it be easier for me to scrape my own leads? Suggestions?

Responder

An intriguing discussion is worth comment. I believe that you ought to publish more on this topic, it may not be a taboo matter but generally people do not speak about such issues. To the next! Cheers!!

Responder

Right here is the right webpage for everyone who wants to find out about this topic. You realize so much its almost tough to argue with you (not that I personally would want to…HaHa). You certainly put a fresh spin on a subject which has been written about for many years. Wonderful stuff, just great!

Responder

It’s difficult to find educated people in this particular subject, but you seem like you know what you’re talking about! Thanks

Responder

I needed to thank you for this excellent read!! I absolutely enjoyed every little bit of it. I have got you book marked to look at new stuff you post…

Responder

Having read this I thought it was really enlightening. I appreciate you finding the time and energy to put this short article together. I once again find myself personally spending a significant amount of time both reading and leaving comments. But so what, it was still worthwhile!

Responder

I really like looking through a post that can make men and women think. Also, many thanks for allowing me to comment!

Responder

May I just say what a relief to uncover somebody who truly understands what they are discussing on the internet. You certainly understand how to bring a problem to light and make it important. A lot more people must read this and understand this side of the story. It’s surprising you are not more popular given that you most certainly possess the gift.

Responder

I’m really enjoying the design and layout of your website.
It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire
out a developer to create your theme? Superb work!

Responder

I wanted to thank you for this wonderful read!! I certainly enjoyed every little bit of it.
I have you saved as a favorite to check out new
things you post… adreamoftrains webhosting

Responder

Very rapidly this web site will be famous amid all blogging viewers,
due to it’s pleasant content

Responder

I do not even know the way I finished up here, however I thought this submit used to be good.
I don’t recognize who you are however certainly you are going
to a well-known blogger in the event you aren’t already.
Cheers!

Responder