There are configuration properties that can be manipulated. Generally, the procedure is "sp_Configure" and it accepts variables for the configuration setting and the new value of the setting.

I am unfamiliar with SQL Server Express, but you would likely have to be an server admin to change the setting (or at least have admin login creds in your code to execute the procedure).

the T-SQL version would be:

[vba]
exec sp_configure 'Ad Hoc Distributed Queries',1
[/vba]

1 being "on", 0 being "off"