0

I am creating a script to print a report using a macro from an Access database and I am trying to make it automatic for every Monday. However when my script is opening the file, there is the security warning and I need to click open to continue.

This file may not be safe if it contains code that was intended to harm your computer. Do you want to open this file or cancel the operation?

Is there a way to bypass this security message when opening the database or to change the security options just for the script?

Here is the code:

Dim accessApp
Set accessApp = CreateObject("Access.Application")
accessApp.Visible = False
accessApp.OpenCurrentDataBase "C:\db1.mdb"

accessApp.Run "MyMacro"
accessApp.Quit

Set accessApp = Nothing

WScript.Quit
user692942
  • 16,398
  • 7
  • 76
  • 175
  • That's the whole point of security, you can't bypass it without the users consent, in this case the way to get around it is run the database from a "Trusted Location" which the user can define inside the Access options dialog, they will also have to modify their macro security settings. – user692942 May 25 '16 at 09:18
  • What exactly is "the security message"? – Ansgar Wiechers May 25 '16 at 10:23
  • 1
    @Lankymart Thanks for you answer, it seems that we can also configure the reg key, but not in Windows Server, I have putted it on a trusted location, it is now working. – Sushignago May 25 '16 at 11:12
  • @AnsgarWiechers "Opening "C:\db1.mdb" The file may not be safe if it contains code that was intended to harm your computer. Do you want to open this file or cancel the operation" with 3 buttons (open, cancel, help) – Sushignago May 25 '16 at 11:15

0 Answers0