by Alessandro Ebersol (Agent Smith)
Guys, isn't it very annoying when others send Excel spreadsheets with macros in VBA (Visual Basic For Applications)?
Yes, everyone thinks that we use pirated copies of MS Office and, therefore, we will be able to work with these spreadsheets. All wrong, since we made the choice to be within the law and, by choice, not to use Microsoft products.
Unfortunately, due to the predominance of Microsoft products, we have to "talk", so to speak, with these programs, but never depend on them. And, we are left with this problem in our hands: How to work with these Excel spreadsheets with these VBA macros? We'll see right after.
VBA macros on Linux: Impossible
Visual Basic for Applications macros are a headache for us, Linux users, because, there is no way to run these macros normally, on Linux, since they depend on proprietary code written in C#.
How then to run these VBA macros on PCLinuxOS ?
Well, why did I get interested in this subject? Because I received a spreadsheet with these macros and had to fill it. But, I don't want to have to hack Windows or Office for that.
And how to do it then? Well, to do that, let's work on a two-step solution.
The two-step solution
To solve this problem, we will have to do it in two steps:
First, obtain a legal copy of Windows XP.
Second, obtain an Office suite that can run the VBA macros legally.
Obtaining Windows XP in 2023
Microsoft itself will help us out here, with Windows XP mode.
In the words of answers.microsoft.com, "Windows XP mode lets you run older Windows XP business software directly on the Windows 7 desktop. Designed primarily for small and medium-sized businesses, Windows XP Mode is provided as a separate download and works only with Windows 7 Professional and Ultimate. Windows XP mode also requires virtualization software, such as Windows Virtual PC. Both are available for free from the Microsoft website. For more information, see Install and use Windows XP mode in Windows 7."
Now, that download is no longer available, at least not from the Microsoft website. But, it is available on Archive.Org, at this link.
From the link above, you should download the Windows XP mode installation file: WindowsXPMode_en-us.zip.
It is a 469 megabyte file.
Now, in possession of this file, it is necessary to extract the file that interests us. With some compression manager (file-roller, Xarchiver), you must open this file WindowsXPMode_en-us.zip.
Inside this file, you must access the sources folder.
Then, you should access the xpm file.
Inside the xpm file, the following files exist.
The file we are interested in is VirtualXPVHD. This file must be extracted. It is in this file that is the Windows XP image that we will use. As for its legitimacy, it is an unactivated Windows XP installation that works for 30 days.
The VirtualXPVHD file must be renamed to the .vhd suffix, so that it can be imported by Virtual Box. Yes, we will use Virtual Box to run this image.
Importing the image into Virtual Box
In Virtual Box, you must create a virtual machine, and import the VirtualXPVHD.vhd image. And, once imported, it is in the list of virtual machines installed.
The second step: The free and legal office suite
Well, now that we have Windows XP installed and configured, it is time to install a free office suite inside this Windows XP virtual machine.
The suite we are going to use is WPS Office, from the Chinese company Kingsoft. WPS Office (an acronym for Writer, Presentation and Spreadsheets, formerly known as Kingsoft Office) is an office suite written in C++ that runs on Windows, Linux, Android and iOS platforms. Developed by the Chinese software developer in Zhuhai, Kingsoft. WPS Office is a software suite that is composed of three main components: WPS Writer, WPS Presentation and WPS Spreadsheet.
The personal basic version is free to use. A full-featured professional-level version is also available for a subscription fee. If you are worried about using software of Chinese origin, don't be, as it will be installed inside a virtual machine and will not affect your system in any way.
I looked for a version of WPS Office that would work with Windows XP, and found it on Old Version.com. That version is WPS Office 2014. To save work, I uploaded it to a mediafire account.
However, this software alone is not enough.
The Magic of VBA macros
Naturally, WPS Office does not run VBA macros. However, Kingsoft has created addons for WPS Office to run VBA macros. In posts on Reddit, I found the addon that works with this version of WPS Office, and also put it on a mediafire account.
Well, I used WPS Spreadsheets, without the VBAxWPS.exe addon installed, and, the response from the program was:
So, I installed the addon.
After installing the addon, WPS Spreadsheets recognizes spreadsheets with VBA macros and shows a security warning:
And voila, WPS Spreadsheets running the VBA macros:
And so, you have a nice solution to an annoying problem, which is receiving spreadsheets with VBA macros.
I hope you enjoyed this tip, and that it may be useful to you. A big hug and until the next article.