mohamed123
mohamed123

Reputation: 51

VBA automatically agree to enable macros

I have a VBA code that is opening a lot of different excel files with macros. However, every time VBA opens a file, it says "Microsoft Office has identified a potential security concern", and I have to select "Enable Macros". Is there a way to add a line, that would always choose "Enable Macros", as I cannot change any excel settings (it is a corporate computer, without admin rights)?

Thank you!

enter image description here

Upvotes: 1

Views: 5083

Answers (1)

Tim Williams
Tim Williams

Reputation: 166306

Typically when opening a macro-enabled file using code, there's no security prompt. It would help to show the code you're using to open the files.

However if you do see a prompt you can fix that by setting Application.AutomationSecurity to the appropriate value

See: https://learn.microsoft.com/en-us/office/vba/api/excel.application.automationsecurity

Upvotes: 1

Related Questions