0

I have since years in my VBA code in MS Access the following lines:

Private Declare PtrSafe Function CoCreateGuid Lib "ole32.dll" (guid As GUID_TYPE) As LongPtr
Private Declare PtrSafe Function StringFromGUID2 Lib "ole32.dll" (guid As GUID_TYPE, ByVal lpStrGuid As LongPtr, ByVal cbMax As Long) As LongPtr

And until now that worked fine on all PCs.

Now, since today, I get a compile error on one PC with Windows 10 and Office 2007 32bit.

I guess Windows updated something automatically. But I am not the administrator of that PC and I see the error only on one PC.

The word PtrSafe is highlighted at when "Compile Error" is shown.

Does anybody know about a recent update which might cause this error? I like to tell the administrator of that PC what they should check for. Just telling them that my VBA does not work anymore won't help much.

Thank for any help

Edit: This question is different from this one Declare PtrSafe Compatibility in Excel Because until now the VBA code was running fine on that PC, for years. The user did not change anything.

I like to know why the error shows now and never showed before.

I guess an automatic Windows update caused this but I can't check it myself on that PC because I have no admin rights. And I don't see the error on any other PC which uses the program.

Edgar
  • 2,527
  • 2
  • 19
  • 40
  • 1
    `Because until now the VBA code was running fine on that PC, for years` - That could have not been the case. VBA7 and the `PtrSafe` keyword [were introduced in Office 2010](https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/ee691831(v=office.14)#introducing-the-32-bit-and-64-bit-versions-of-microsoft-office-2010) like the duplicate question [also mentions](https://stackoverflow.com/questions/26822004/declare-ptrsafe-compatibility-in-excel#comment42222445_26822004). If that code worked before, then you must have had Office 2010+ and then downgraded it to 2007. – GSerg Jan 02 '19 at 13:04
  • Thank @GSerg, I appreciate your time to answer this. Now I remember the PC had a some stage, years ago, Office 2010 installed but then it was replaced by Office 2007. Like I mentioned above, I am not the admin of that PC. It seems there was some leftover from Office 2010 which caused that strange behavior. Now I asked the admin to update it to 2010+... – Edgar Jan 03 '19 at 01:07

0 Answers0