3
I made several attempts to execute a macro when starting Excel as indicated in the searches I did, although these indications are very simple, in my case did not work.
I followed the following script:
Double click on "Esta_pasta_de_work" in the VBA Project, in "Microsoft Excel Objects"
I filled in the code as below:
Public Sub Auto_Open()
MsgBox ("Ok")
End Sub
I ran the macro generated for testing and it worked.
I saved the spreadsheet "macros enabled"
I closed the spreadsheet and called it, the spreadsheet is open but the macro is not executed.
To test, I left a syntax error in the code, saved, closed and called again, and even the error was not shown (when executing the macro manually the error is shown), that is, the boot macro is being ignored (syntax check, just because it is not running).
I changed some of the Excel settings, such as the macros, for example, but they did not have an effect.
Before I was testing the call of a function by the Call command, calling another macro or having a form opened, and also did not work.
What is missing or what is wrong in this case?
Just one observation: Setting up Excel to run code automatically can lead to severe security breaches. This is not recommended on virtually any occasion, especially when speaking on a desktop, as it may allow third parties to capture and monitor computer data.
– utluiz