0

Is it possible to open an Excel file developed with Office 2016 (32 bit) which includes incompatible instructions (in macros) with Office 365 (64 bit) from Office 365 (64 bit)? Like an add-in or something... We refer to something like right clicking the file and opening it in another way or Excel 365 being able to recognize the source of the problem and trying to open it in another way.

The problem is that we have over a thousand Excel files and it's not possible to modify every each of them.

Here is the first example of the code:

Option Explicit

Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" ( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long 

Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" ( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) As Long

The declaration Private Declare Function is not compatible with Office 365.

Here is the second example of the code:

cn.Open "Driver={MySQL ODBC 3.51 Driver}" & _
";Server=" & Server_Name_INI & _
";Database=" & DB_Name_INI & _
";Uid=" & User_ID & _
";Pwd=" & Password & ";"

The driver MySQL ODBC 3.51 Driver is not compatible with Office 365.

We know that we could fix it by replacing these instructions with the compatible ones. The thing is that we have over a thousand files and this solution would take us too much time.

Any help would be really appreciated!

NIrigoyen
  • 1
  • 1
  • 1
  • No, the function declares need to be modified to work with a 64 bit Office. You would need to take that time. Check out [Compatibility between the 32-bit and 64-bit versions of Office](https://learn.microsoft.com/en-us/office/client-developer/shared/compatibility-between-the-32-bit-and-64-bit-versions-of-office). It gives an overview of what has to be changed to make them compatible. – Pᴇʜ Sep 24 '20 at 11:26
  • Oh ok, and is it possible to edit Excel macros externally? I mean with a program, replacing the incompatible instructions with their compatible peers. The people that use this Excel files aren't programmers and we're thinking of developing a small .bat-like program that changes the code externally to make it compatible... – NIrigoyen Sep 24 '20 at 11:30
  • If the macros in all files are the same you can export them and import into another file which would be the most reliable way (I recommend this). If they are all different and you plan to search/replace, then be aware that you will run into a lot of issues probably. Individual code needs very likely an individual review (that is actually why there is no built in conversion from Microsoft). Check out [Change VBA coding with VBA Coding](https://stackoverflow.com/questions/26509578/change-vba-coding-with-vba-coding) If you want to change VBA code with VBA (I cannot recommend that). – Pᴇʜ Sep 24 '20 at 11:34

0 Answers0