• OS Specific VBA Code

    Does your clients report OS related issues often?

    Sometimes, Yes.

    The Vba macro might end up in Microsoft 32 bit or 64 bit or a Mac IOS system. How to make a Vba code compatible with different Operating systems.

    Here is the 2 simple methods to determine OS version within Excel Macro.

    64 bit Vs 32 bit  or Windows Vs Mac IOS

    Introduction of 64 bit machines has many advantages. But still it is a headache for the many developers. Since they have to migrate their old programmed codes from 32 bit to 64 bit.

    They have to add bunch of code to do this verification. If you are looking to convert your already delivered 32-bit version of VBA to 64 bit version, then refer this article.

    Also Read: Create Keyboard Shortcut - to VBA Macro code - in Excel

    How To find OS Version using VBA?

    Well, there are 2 methods.

    1. Application.Operating system is the widely used function that you will get in most of the websites. But there is another method too.
    2. Using Vba pre-processor directives. Lets see what is it all about.

    Yes. VBA has inbuilt pre-processor directives to categorize operating ssytem. This method is also used to find if the code is executed in Mac or Windows.

    When you refer the other article to convert 32-bit to 64 bit, this same directives are used to categorize the declaration of public variables.

    This issue come mainly when you use any windows API function within your code.

    Previous Post:
    Next Post: