Microsoft Visual Basic for Applications (VBA) is the version of Visual Basic that ships with Microsoft Office. In Microsoft Office 2010, VBA includes language features that enable VBA code to run correctly in both 32-bit and 64-bit environments.
Running VBA code that was written before the Office 2010 release (VBA version 6 and earlier) on a 64-bit platform can result in errors if the code is not modified to run in 64-bit versions of Office. Errors will result because VBA version 6 and earlier implicitly targets 32-bit platforms, and typically contains Declare statements that call into the Windows API by using 32-bit data types for pointers and handles. Because VBA version 6 and earlier does not have a specific data type for pointers or handles, it uses the Long data type, which is a 32-bit 4-byte data type, to reference pointers and handles. Pointers and handles in 64-bit environments are 8-byte 64-bit quantities. These 64-bit quantities cannot be held in 32-bit data types.
The problem with running legacy VBA code in 64-bit Office is that trying to load 64-bits into a 32-bit data type truncates the 64-bit quantity. This can result in memory overruns, unexpected results in your code, and possible application failure.
To address this problem and enable VBA code to work correctly in both 32-bit and 64-bit environments, several language features have been added to VBA. The table at the bottom of this document summarizes the new VBA language features. Three important additions are the LongPtr type alias, the LongLong data type, and the PtrSafe keyword.
All Declare statements must now include the PtrSafe keyword when running in 64-bit versions of Office. It's important to understand that simply adding the PtrSafe keyword to a Declare statement only signifies that the Declare statement explicitly targets 64-bits. All data types within the statement that need to store 64-bits (including return values and parameters) must still be modified to hold 64-bit quantities.
Consider the following Declare statement examples. Running the unmodified Declare statement in 64-bit versions of Office will result in an error indicating that the Declare statement does not include the PtrSafe qualifier. The modified VBA example contains the PtrSafe qualifier, but notice that the return value (a pointer to the active window) returns a Long data type. On 64-bit Office, this is incorrect because the pointer needs to be 64-bits. The PtrSafe qualifier tells the compiler that the Declare statement is targeting 64-bits, so the statement executes without error. But because the return value has not been updated to a 64-bit data type, the return value is truncated, resulting in an incorrect value returned.
To reiterate, you must modify the Declare statement to include the PtrSafe qualifier, and you must update any variables within the statement that need to hold 64-bit quantities so that the variables use 64-bit data types.
In summary, for code to work in 64-bit versions of Office, you need to locate and modify all existing Declare statements to use the PtrSafe qualifier. You also need to locate and modify all data types within these Declare statements that reference handles or pointers to use the new 64-bit compatible LongPtr type alias, and types that need to hold 64-bit integrals with the new LongLong data type. Additionally, you must update any user defined types (UDTs) that contain pointers or handles and 64-bit integrals to use 64-bit data types, and verify that all variable assignments are correct to prevent type mismatch errors.
Note that if you require different logic to execute, for example, you need to manipulate 64-bit values in large Excel projects, you can use the Win64 conditional compilation constant as shown in the following section.
To write code that can work in both new and older versions of Office, you can use a combination of the new VBA7 and Win64 conditional Compiler constants. The Vba7 conditional compiler constant is used to determine if code is running in version 7 of the VB editor (the VBA version that ships in Office 2010). The Win64 conditional compiler constant is used to determine which version (32-bit or 64-bit) of Office is running.
When the English language pack is downloaded, I receive the following file setuplanguagepack.x86.en-us_.exe, which fails to install on a 64-bit Volume Licensing Office 2016 installation with the following message:
Since you have installed 32-bit and 64-bit components of Office 2016 together, you will need to uninstall either one of them. The safest way is to uninstall Office 2016 completely and install one version. Do not use setup.exe provided in the Microsoft Office 2016 DVD. Instead, open the "Office" folder and run setup32.exe or setup64.exe appropriately.
Most aspects of deploying think-cell are the same on both supported platforms (Windows or macOS). If there is some variation in detail, this is mentioned directly in the text. The mechanics of the initial installation and the distribution mechanism of configuration settings differ more substantially and are described in separate sections. If you only administer think-cell on Windows, feel free to skip the installation section for macOS, and vice versa.
All supported languages are included in the same, unified installation package. If a language is not yet supported by think-cell, English is used. It is not possible to alter the automatic language selection behaviour.
think-cell tightly integrates with PowerPoint and Excel to offer its streamlined user interface and wealth of functionality. Due to the tight integration, it is not possible to guarantee compatibility with unknown future changes to Microsoft Office. Therefore:
think-cell has built-in automatic update support. In this way, we ensure compatibility with any Microsoft update and provide new features. When PowerPoint or Excel are started, the software checks for a new version. If there is one, the software attempts to install the update.
If available, think-cell uses the Microsoft Background Intelligent Transfer Service (BITS) to download updates on Windows. BITS automatically frees bandwidth when the user needs it, and also recovers gracefully from network interruptions common in mobile computing environments. Each update is approximately 95 MB in size.
All files that are executed and installed by the automatic update are digitally signed by think-cell. The integrity of the update is verified against a self-signed certificate that is included in the version of think-cell currently installed.
Current Channel (Preview):
The think-cell update is available for download, but we do not always trigger a timely automatic update. When a conflict occurs and you have error reporting enabled, the update will be installed automatically. If you have error reporting disabled and support email not redirected (see Troubleshooting and critical errors), and the user selects Request Support in the error dialog, they will get an automatic email response even outside of our business hours including a link to the update download.
Beta Channel
We make the think-cell update available as soon as possible after the Microsoft update, but outages may occur. Once the think-cell update is ready, the distribution mechanism is the same as for Preview channels.
think-cell can be configured in a variety of ways to fit with your particular needs and environment. Below is a table of think-cell configuration parameters available for both Windows and Mac installations. On Windows, some additional configuration options for the A.2.2.4 Ribbon are available. For details on how to use a parameter with:
Deploying or changing configuration parameters via the Windows Installer command line is only possible when (re-)installing think-cell. Parameters can be deployed and changed using one of the other three methods also for an existing installation.
For macOS, all keys listed below have to be prefixed with com.think-cell.settings. and target the com.microsoft.office domain. For example, the full licensekey key is com.think-cell.settings.licensekey. If the key listed in the table is of the form [parent key].[subkey], e.g. reports.enabled, then the parent key is of type dict and the subkey is of the type given. For example, reports.enabled is listed as type boolean, which is the type of the enabled key contained in the value of the key of type dict whose full name is com.think-cell.settings.reports.
think-cell can be installed per-machine or per-user. If the installing user has admin rights or can elevate via Windows User Account Control (UAC), the default is to use the per-machine context. However, if a user is allowed to install software but does not have admin rights and cannot elevate via UAC, the per-user context is used.
Based on standard behavior of the Windows Installer mechanism it is possible for different think-cell versions to be installed in parallel if they are installed in different contexts (e.g., different versions installed per-user for different user accounts, or a different version installed per-user and per-machine, respectively). If more than one installation exists, it is always the per-user installation of a given user account that is executed. Any other installations (including a per-machine installation) are ignored. This is true even if the per-user installation is an older version than a parallel per-machine installation.
To interact with Microsoft PowerPoint and Microsoft Excel, the installation of think-cell creates some new keys in the following sections of the Windows registry. Depending on whether you have a regular installation or a single-user-installation, the keys are created in the HKEY_LOCAL_MACHINE or in the HKEY_CURRENT_USER section:
03c5feb9e7