Share via


Access 365 VBA Code not Running

Question

Sunday, July 9, 2017 1:12 PM

Our firm recently replaced Office 2013 with Office 365 on our company laptops.

It seems that the VBA code is being detached from the form.  I can create a brand new blank database, add a table and add a form for that table.  I add a button to the form and add a button_click() event that displays a MsgBox.  It works the first time.

Once I close the file and reopen it, the button_click() event no longer runs the VBA code and the MsgBox no longer appears.  The VBA code is still there and is attached to the button_click() event.  However, nothing happen when the button is clicked.

We developed some complex Access applications using Access 2013 with plenty of VBA code in the form control events.  The app no longer works and we are forced to use virtual machines that are running Access 2013.

Form - 'Has Module' is set to Yes.

We have version 1701 of Office (7766.2092)

 

All replies (1)

Sunday, July 9, 2017 2:11 PM âś…Answered

Check File > Options > Trust Center > Trust Center Settings... > Macro Settings.

Make sure that 'Disable all macros with notification' is selected (or 'Enable all macros', but that could pose a security risk).

And preferably, make the folder containing the database a trusted location for Access in File > Options > Trust Center > Trust Center Settings... > Trusted Locations.

Regards, Hans Vogelaar (http://www.eileenslounge.com)