Winbox is an executable program that is used to connect to and configure Mikrotik RouterOS routers via a graphical user interface.
-->Descubra cómo la versión de 32 bits de Office es compatible con de 64 bits.Find out how the 32-bit version of Office is compatible with the 64-bit version of Office.
Las aplicaciones de Office están disponibles en versiones de 32 y 64 bits.Office applications are available in 32-bit and 64-bit versions.
Las versiones de 64 bits de Office permiten desplazar más datos para obtener una mayor capacidad, por ejemplo, al trabajar con números grandes en Microsoft Excel 2010.The 64-bit versions of Office enable you to move more data around for increased capability, for example when you work with large numbers in Microsoft Excel 2010.Al escribir código de 32 bits, puede usar la versión de 64 bits de Office sin cambios.When writing 32-bit code, you can use the 64-bit version of Office without any changes.Sin embargo, al escribir el código de 64 bits, debe asegurarse de que el código contiene palabras clave específicas y constantes de compilación condicional para asegurarse de que el código es compatible con la versión anterior de Office y que el código correcto se ejecuta si se combinan códigos de 32 y 64 bits.However, when you write 64-bit code, you should ensure that your code contains specific keywords and conditional compilation constants to ensure that the code is backward compatible with earlier version of Office, and that the correct code is being executed if you mix 32-bit and 64-bit code.
Visual Basic para Aplicaciones 7.0 (VBA 7) se publicó en las versiones de 64 bits de Office y funciona tanto con aplicaciones de 32 como de 64 bits.Visual Basic for Applications 7.0 (VBA 7) is released in the 64-bit versions for Office, and it works with both 32-bit and 64-bit applications.Los cambios descritos en este artículo solo se aplican a las versiones de 64 bits de Office.The changes described in this article apply only to the 64-bit versions of Office.Usar las versiones de 32 bits de Microsoft Office le permite utilizar soluciones integradas en versiones anteriores de Office sin realizar modificaciones.Using the 32-bit versions of Microsoft Office enable you to use solutions built in previous versions of Office without further modifications.
Nota
De forma predeterminada, cuando se instala una versión de 64 bits de Office, también se instala la versión de 32 bits con el sistema de 64 bits.By default, when you install a 64-bit version of Office, you also install the 32-bit version is installed along with the 64-bit system.Debe seleccionar explícitamente la opción de instalación de la versión de 64 bits de Microsoft Office.You must explicitly select the Microsoft Office 64-bit version installation option.
En VBA 7, se deben actualizar las instrucciones existentes de la API de Windows (instrucciones Declarar) para que funcione con la versión de 64 bits.In VBA 7, you must update existing Windows API statements (Declare statements) to work with the 64-bit version.Además, se deben actualizar los punteros de dirección y los controladores de ventanas en los tipos definidos por el usuario que usan estas instrucciones.Additionally, you must update address pointers and display window handles in user-defined types that are used by these statements.Esto se describe en detalle en este artículo, así como también los problemas de compatibilidad entre las versiones de 32 y 64 bits y las soluciones recomendadas.This is discussed in more detail in this article as well as compatibility issues between the 32-bit and 64-bit versions and suggested solutions.
Comparación de los sistemas de 32 y 64 bitsComparing 32-bit and 64-bit systems
Las aplicaciones integradas con las versiones de 64 bits de Office pueden hacer referencia a espacios de direcciones más grandes que las versiones de 32 bits.Applications built with the 64-bit versions of Office can reference larger address spaces than 32-bit versions.Esto significa que puede usar más memoria física para datos que antes, lo que probablemente reduzca la sobrecarga utilizada en la entrada y salida de datos de la memoria físicaThis means you can use more physical memory for data than before, potentially reducing the overhead spent moving data in and out of physical memory
Además de hacer referencia a ubicaciones específicas (denominadas punteros) en la memoria física, también puede usar direcciones para hacer referencia a los identificadores de ventanas (denominados controladores).In addition to referring specific locations (known as pointers) in physical memory, you can also use addresses to reference display window identifiers (known as handles).El tamaño (en bytes) del puntero o controlador depende de si usa un sistema de 32 o 64 bits.The size (in bytes) of the pointer or handle depends on whether you're using a 32-bit or 64-bit system.
Si desea ejecutar las soluciones existentes con las versiones de 64 bits de Office, tenga en cuenta lo siguiente:If you want to run your existing solutions with the 64-bit versions of Office, be aware of the following:
- Los procesos nativos de 64 bits de Office no pueden cargar archivos binarios de 32 bits.Native 64-bit processes in Office cannot load 32-bit binaries.Este será un problema habitual cuando se tengan ya controles Microsoft ActiveX y complementos.This is expected to be a common issue when you have existing Microsoft ActiveX controls and existing add-ins.
- Anteriormente, VBA no tenía un tipo de datos de punteros, por lo que se tenían que usar variables de 32 bits para almacenar punteros y controladores.VBA previously didn't have a pointer data type, so you had to use 32-bit variables to store pointers and handles.Ahora, estas variables truncan los valores de 64 bits devueltos por las llamadas a la API al usar instrucciones Declarar.These variables now truncate 64-bit values returned by API calls when using Declare statements.
Base del código de VBA 7VBA 7 code base
VBA 7 reemplaza la base del código VBA en Office 2007 y versiones anteriores.VBA 7 replaces the VBA code base in Office 2007 and earlier versions.VBA 7 se encuentra disponible tanto en la versión de 32 como en la de 64 bits de Office.VBA 7 is available in both the 32-bit and 64-bit versions of Office.Ofrece dos constantes de compilación condicional:It provides two conditional compilation constants:
- VBA7: ayuda a garantizar la compatibilidad con versiones anteriores del código al comprobar si la aplicación usa VBA 7 o la versión anterior.VBA7 - Helps ensure the backward compatibility of your code by testing whether your application is using VBA 7 or the previous version of VBA.
- Win64: comprueba si el código se ejecuta en 32 o 64 bits.Win64 Tests whether code is running as 32-bit or 64-bit.
Con algunas excepciones, las macros de un documento que funcionan en la versión de 32 bits de la aplicación también funcionan en la versión de 64 bits.With certain exceptions, the macros in a document that work in the 32-bit version of the application also work in the 64-bit version.
Compatibilidad de controles ActiveX y complementos COMActiveX control and COM add-in compatibility
Los controles ActiveX de 32 bits existentes no son compatibles con las versiones de 64 bits de Office.Existing 32-bit ActiveX controls, are not compatible with the 64-bit versions of Office.Para controles ActiveX y objetos COM:For ActiveX controls and COM objects:
- Si se dispone del código fuente, puede generar una versión de 64 bits.If you have the source code, generate a 64-bit version yourself.
- Si no cuenta con el código fuente, póngase en contacto con el proveedor para obtener una versión actualizada.If you don't have the source code, contact the vendor for an updated version.
Los procesos nativos de 64 bits de Office no pueden cargar archivos binarios de 32 bits.Native 64-bit processes in Office cannot load 32-bit binaries.Esto incluye los controles comunes de MSComCtl (TabStrip, Toolbar, StatusBar, ProgressBar, TreeView, ListViews, ImageList, Slider, ImageComboBox) y los controles de MSComCt2 (Animation, UpDown, MonthView, DateTimePicker, FlatScrollBar).This includes the common controls of MSComCtl (TabStrip, Toolbar, StatusBar, ProgressBar, TreeView, ListViews, ImageList, Slider, ImageComboBox) and the controls of MSComCt2 (Animation, UpDown, MonthView, DateTimePicker, FlatScrollBar).Estos controles se instalaron con versiones de 32 bits de Office anteriores a Office 2010.These controls were installed by 32-bit versions of Office earlier than Office 2010.Deberá buscar una alternativa para las soluciones de VBA existentes que usan estos controles al migrar el código a las versiones de 64 bits de Office.You'll need to find an alternative for your existing VBA solutions that use these controls when you migrate the code to the 64-bit versions of Office.
Compatibilidad de APIAPI compatibility
La combinación de las bibliotecas de VBA y de tipos ofrece una gran variedad de funcionalidad para crear aplicaciones de Office.The combination of VBA and type libraries gives you lots of functionality to create Office applications.Sin embargo, a veces debe comunicarse directamente con el sistema operativo y otros componentes, como cuando administra la memoria o los procesos al trabajar con elementos de la interfaz de usuario, tales como controles y ventanas o cuando se modifica el registro de Windows.However, sometimes you must communicate directly with the computer's operating system and other components, such as when you manage memory or processes, when working with UI elements linke windows and controls, or when modifying the Windows registry.En estos casos, la mejor opción es usar una de las funciones externas incrustadas en archivos DLL.In these scenarios, your best option is to use one of the external functions that are embedded in DLL files.Para ello en VBA, realice llamadas a la API con instrucciones Declarar.You do this in VBA by making API calls using Declare statements.
Nota
Microsoft proporciona un archivo Win32API.txt con 1 500 instrucciones Declarar y una herramienta para copiar la que desee en el código.Microsoft provides a Win32API.txt file that contains 1,500 Declare statements and a tool to copy the Declare statement that you want into your code.Sin embargo, estas instrucciones son para sistemas de 32 bits y deben convertirse a 64 bits con la información que se describe más adelante en este artículo.However, these statements are for 32-bit systems and must be converted to 64-bit by using the information discussed later in this article.Las instrucciones Declarar existentes no se compilarán en VBA de 64 bits hasta que hayan sido marcadas como seguras para 64 bits a través del atributo PtrSafe.Existing Declare statements won't compile in 64-bit VBA until they've been marked as safe for 64-bit by using the PtrSafe attribute.Encontrará ejemplos de este tipo de conversión en el sitio web de Jan Karel Pieterse https://www.jkp-ads.com/articles/apideclarations.asp sobre Excel MVP.You can find examples of this type of conversion at Excel MVP Jan Karel Pieterse's website at https://www.jkp-ads.com/articles/apideclarations.asp.La Guía del usuario de Office Code Compatibility Inspector es una herramienta útil para inspeccionar la sintaxis de las instrucciones Declarar de la API para el atributo PtrSafe, si es necesario, y el tipo de valor devuelto correspondiente.The Office Code Compatibility Inspector user's guide is a useful tool to inspect the syntax of API Declare statements for the PtrSafe attribute, if needed, and the appropriate return type.
Las instrucciones Declarar se verán como algunas de las siguientes, dependiendo de si se llama a una subrutina (que no tiene valor devuelto) o a una función (que sí tiene un valor devuelto).Declare statements resemble one of the following, depending on whether you are calling a subroutine (which has no return value) or a function (which does have a return value).
La función SubName o FunctionName se reemplaza por el nombre real del procedimiento en el archivo DLL y representa el nombre que se usa cuando se llama al procedimiento desde el código de VBA.The SubName function or FunctionName function is replaced by the actual name of the procedure in the DLL file and represents the name that is used when the procedure is called from VBA code.También puede especificar un argumento AliasName para el nombre del procedimiento.You can also specify an AliasName argument for the name of the procedure.El nombre del archivo DLL que contiene el procedimiento al que se llama se coloca a continuación de la palabra clave Lib.The name of the DLL file that contains the procedure being called follows the Lib keyword.Y por último, la lista de argumentos contiene los parámetros y los tipos de datos que se deben pasar al procedimiento.And finally, the argument list contains the parameters and the data types that must be passed to the procedure.
La siguiente instrucción Declarar abre una subclave en el registro de Windows y reemplaza su valor.The following Declare statement opens a subkey in the Windows registry and replaces its value.
La entrada Windows.h (controlador de la ventana) de la función RegOpenKeyA es la siguiente:The Windows.h (window handle) entry for the RegOpenKeyA function is as follows:
En Visual C y Microsoft Visual C++, el ejemplo anterior compila correctamente tanto para 32 como para 64-bits.In Visual C and Microsoft Visual C++, the previous example compiles correctly for both 32-bit and 64-bit.Esto es porque HKEY está definido como un puntero, cuyo tamaño refleja el tamaño de la memoria de la plataforma en la que se compila el código.This is because HKEY is defined as a pointer, whose size reflects the memory size of the platform that the code is compiled in.
En versiones anteriores de VBA, no había ningún tipo de datos específico del puntero así que se utilizó el tipo de datos Long.In previous versions of VBA, there was no specific pointer data type so the Long data type was used.Además, dado que el tipo de datos Long siempre es de 32 bits, este se interrumpe cuando se utiliza en un sistema con memoria de 64 bits ya que los 32 bits superiores pueden truncarse o podrían sobrescribir otras direcciones de memoria.And because the Long data type is always 32-bits, this breaks when used on a system with 64-bit memory because the upper 32-bits might be truncated or might overwrite other memory addresses.Cualquiera de estas situaciones puede causar comportamientos impredecibles o bloqueos del sistema.Either of these situations can result in unpredictable behavior or system crashes.
Para resolver esto, VBA incluye un verdadero tipo de datos puntero: LongPtr.To resolve this, VBA includes a true pointer data type: LongPtr.Este nuevo tipo de datos le permite escribir la instrucción Declarar original correctamente como:This new data type enables you to write the original Declare statement correctly as:
![Mikrotik news Mikrotik news](/uploads/1/2/5/7/125780584/358618883.jpg)
Este tipo de datos y el nuevo atributo PtrSafe le permiten utilizar esta instrucción Declarar en sistemas de 32 o 64 bits.This data type and the new PtrSafe attribute enable you to use this Declare statement on either 32-bit or 64-bit systems.El atributo PtrSafe le indica al compilador de VBA que la instrucción Declarar está destinada a la versión de 64 bits de Office.The PtrSafe attribute indicates to the VBA compiler that the Declare statement is targeted for the 64-bit version of Office.Sin este atributo, al usar la instrucción Declarar en un sistema de 64 bits se producirá un error en tiempo de compilación.Without this attribute, using the Declare statement in a 64-bit system will result in a compile-time error.El atributo PtrSafe es opcional, en la versión de 32 bits de Office.The PtrSafe attribute is optional on the 32-bit version of Office.Esto permite que las instrucciones Declarar existentes funcionen de manera habitual.This enables existing Declare statements to work as they always have.
![Routeros Routeros](http://img.techpowerup.org/120908/mikrotik%20v5.18%20cracked%20lev6%20license.jpg)
La siguiente tabla proporciona más información sobre el nuevo calificador y el tipo de datos, así como otro tipo de datos, dos operadores de conversión y tres funciones.The following table provides more information about the new qualifier and data typeas well as another data type, two conversion operators, and three functions.
TipoType | ItemItem | DescripciónDescription |
---|---|---|
CalificadorQualifier | PtrSafePtrSafe | Indica que la instrucción Declarar es compatible con 64 bits. Este atributo es obligatorio en sistemas de 64 bits. Indicates that the Declare statement is compatible with 64-bits. This attribute is mandatory on 64-bit systems. |
Tipo de datosData Type | LongPtrLongPtr | Un tipo de datos variable que es un tipo de datos de 4 bytes en versiones de 32 bits y un tipo de datos de 8 bytes en versiones de 64 bits de Microsoft Office.A variable data type which is a 4-bytes data type on 32-bit versions and an 8-byte data type on 64-bit versions of Microsoft Office.Esta es la manera recomendada de declarar un puntero o un controlador para un código nuevo, pero también para el código heredado si se tiene que ejecutar en la versión de 64 bits de Office.This is the recommended way of declaring a pointer or a handle for new code but also for legacy code if it has to run in the 64-bit version of Office.Solo es compatible en el tiempo de ejecución de VBA 7 de 32 y 64 bits.It is only supported in the VBA 7 runtime on 32-bit and 64-bit.Tenga en cuenta que puede asignarle valores numéricos, pero no tipos numéricos.Note that you can assign numeric values to it but not numeric types. |
Tipo de datosData Type | LongLongLongLong | Este es un tipo de datos de 8 bytes que solo está disponible en versiones de 64 bits de Microsoft Office.This is an 8-byte data type which is available only in 64-bit versions of Microsoft Office.Puede asignar valores numéricos, pero no tipos numéricos (para evitar truncamiento).You can assign numeric values but not numeric types (to avoid truncation). |
Operador de conversiónConversion Operator | CLngPtrCLngPtr | Convierte una expresión sencilla en un tipo de datos LongPtr.Converts a simple expression to a LongPtr data type. |
Operador de conversiónConversion Operator | CLngLngCLngLng | Convierte una expresión sencilla en un tipo de datos LongLong.Converts a simple expression to a LongLong data type. |
FunciónFunction | VarPtrVarPtr | Convertidor Variant. Devuelve un LongPtr en versiones de 64 bits y un Long en versiones de 32 bits (4 bytes).Variant converter. Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes). |
FunciónFunction | ObjPtrObjPtr | Convertidor Object. Devuelve un LongPtr en versiones de 64 bits y un Long en versiones de 32 bits (4 bytes).Object converter. Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes). |
FunciónFunction | StrPtrStrPtr | Convertidor String. Devuelve un LongPtr en versiones de 64 bits y un Long en versiones de 32 bits (4 bytes).String converter. Returns a LongPtr on 64-bit versions, and a Long on 32-bit versions (4 bytes). |
El siguiente ejemplo muestra cómo usar algunos de estos elementos en una instrucción Declarar.The follow example shows how to use some of these items in a Declare statement.
Tenga en cuenta que se asume que las instrucciones Declarar sin el atributo PtrSafe no son compatibles con la versión de 64 bits de Office.Note that Declare statements without the PtrSafe attribute are assumed not to be compatible with the 64-bit version of Office.
Existen dos constantes de compilación condicional: VBA7 y Win64.There are two conditional compilation constants: VBA7 and Win64.Para garantizar la compatibilidad con versiones anteriores de Microsoft Office, se utiliza la constante VBA7 (esto es lo más habitual) para evitar que el código de 64 bits se use en la versión anterior de Office.To ensure backward compatibility with previous versions of Microsoft Office, you use the VBA7 constant (this is the more typical case) to prevent 64-bit code from being used in the earlier version of Office.Para todo código que sea diferente de la versión de 32 y la de 64 bits, como por ejemplo, llamar a una API de matemáticas que utiliza LongLong para su versión de 64 bits y Long para su versión de 32 bits, se usa la constante Win64.For code that is different between the 32-bit version and the 64-bit version, such as calling a math API that uses LongLong for its 64-bit version and Long for its 32-bit version, you use the Win64 constant.El siguiente código muestra el uso de estas dos constantes.The following code shows the use of these two constants.
En resumen, si escribe código de 64 bits y desea usarlo en versiones anteriores de Office, tendrá que usar la constante de compilación condicional VBA7.To summarize, if you write 64-bit code and intend to use it in previous versions of Office, you will want to use the VBA7 conditional compilation constant.Sin embargo, si escribe código de 32 bits en Office, ese código funciona como en versiones anteriores de Office sin necesidad de usar la constante de compilación.However, if you write 32-bit code in Office, that code works as is in previous versions of Office without the need for the compilation constant.Si desea asegurarse de que está usando instrucciones de 32 bits para versiones de 32 bits e instrucciones de 64 bits para versiones de 64 bits, la mejor opción es usar la constante de compilación condicional Win64.If you want to ensure that you are using 32-bit statements for 32-bit versions and 64-bit statements for 64-bit versions, your best option is to use the Win64 conditional compilation constant.
Uso de atributos de compilación condicionalUsing conditional compilation attributes
El siguiente ejemplo muestra el código VBA escrito para 32 bits que debe actualizarse.The following example shows VBA code written for 32-bit that needs to be updated.Observe los tipos de datos en el código heredado que se actualizan para usar LongPtr ya que hacen referencia a punteros o controladores.Notice the data types in the legacy code that are updated to use LongPtr because they refer to handles or pointers.
Código VBA escrito para versiones de 32 bitsVBA code written for 32-bit versions
Código VBA reescrito para versiones de 64 bitsVBA code rewritten for 64-bit versions
Preguntas más frecuentesFrequently asked questions
¿Cuándo debería usar la versión de 64 bits de Office?When should I use the 64-bit version of Office?
Depende, en gran medida, de la aplicación host (Word, Excel, etc.) que utiliza.This is more a matter of which host application (Excel, Word, and so forth) you are using.Por ejemplo, Excel es capaz de manejar hojas de cálculo mucho más grandes con la versión de 64 bits de Microsoft Office.For example, Excel is able to handle much larger worksheets with the 64-bit version of Microsoft Office.
¿Puedo instalar las versiones de 32 y 64 bits de Office en paralelo?Can I install 64-bit and 32-bit versions of Office side-by-side?
No.No.
¿Cuándo debo convertir los parámetros Long a LongPtr?When should I convert Long parameters to LongPtr?
Debe comprobar la documentación de la API de Windows en Microsoft Developers Network para la función que desea llamar.You need to check the Windows API documentation on the Microsoft Developers Network for the function you want to call.Es necesario convertir los controladores y punteros a LongPtr.Handles and pointers need to be converted to LongPtr.Por ejemplo, la documentación de RegOpenKeyA proporciona la siguiente firma:As an example, the documentation for RegOpenKeyA provides the following signature:
Los parámetros se definen como:The parameters are defined as:
ParámetroParameter | DescripciónDescription |
---|---|
hKey [in]hKey [in] | Un controlador a una clave del registro abierta.A handle to an open registry key. |
lpSubKey [in, opcional]lpSubKey [in, optional] | El nombre de la subclave del registro que se abrirá.The name of the registry subkey to be opened. |
ulOptionsulOptions | Este parámetro está reservado y debe ser cero.This parameter is reserved and must be zero. |
samDesired [in]samDesired [in] | Máscara que especifica los derechos de acceso deseados a la clave.A mask that specifies the desired access rights to the key. |
phkResult [out]phkResult [out] | Un puntero a una variable que recibe un controlador a la clave abierta.A pointer to a variable that receives a handle to the opened key. |
En Win32API_PtrSafe.txt, la instrucción Declarar se define como:In Win32API_PtrSafe.txt, the Declare statement is defined as:
¿Debo convertir punteros y controladores en estructuras?Should I convert pointers and handles in structures?
Sí.Yes.Consulte el tipo MSG en Win32API_PtrSafe.txt:See the MSG type in Win32API_PtrSafe.txt:
¿Cuándo debo usar strptr, varpt y objptr?When should I use strptr, varpt, and objptr?
Debe usar estas funciones para recuperar punteros a cadenas, variables y objetos, respectivamente.You should use these functions to retrieve pointers to strings, variables and objects, respectively.En la versión de 64 bits de Office, estas funciones devuelven un parámetro LongPtr de 64 bits, que se puede pasar a las instrucciones Declarar.On the 64-bit version of Office, these functions will return a 64-bit LongPtr, which can be passed to Declare statements.El uso de estas funciones no ha cambiado de versiones anteriores de VBA.The use of these functions has not changed from previous versions of VBA.La única diferencia es que ahora devuelven un parámetro LongPtr.The only difference is that they now return a LongPtr.