View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Simon Murphy[_4_] Simon Murphy[_4_] is offline
external usenet poster
 
Posts: 37
Default Code Halt - prevents reset of the AutomationSecurity level

Walt
I had the same problem
In the end I compiled the caller into a VB6.0 exe which worked fine. It
does seem to halt the whole of vba.
In the vba version I stripped the automationSecurity stuff and relied on
disabling events and calculation, on the basis that this would stop any code
being triggered.

cheers
Simon

"Walt" wrote:

Hi,

Starting with a copy of the sample from the help system, I modified it
slightly as you can see below. I find that not only is the code in an
unsigned project prevented from running (As intended), but all code,
even in the project 'controlling' the open, is immediately halted.
This prevents the reset of the AutomationSecurity level.

'MODIFIED FROM VBA HELP SAMPLE
Sub Security() 'TEST WITH SECURITY DG SET TO HIGH
Dim secAuto As MsoAutomationSecurity
secAuto = Application.AutomationSecurity

'MODIFIED FROM FORCEDISABLE TO ByUI
Application.AutomationSecurity = msoAutomationSecurityByUI
'MODIFIED THIS LINE
Application.Dialogs(xlDialogOpen).Show

'CODE HALTS, & NEVER GETS TO NEXT LINE
'IF ANY FILES OPENED HAVE CODE
'PREVENTED FROM RUNNING BY THE
'MACRO SECURITY
Application.AutomationSecurity = secAuto
End Sub

Does anyone know a better way to do this?

Best Regards,
Walt Weber