Programmatic access to Visual Basic is not trusted
I want to export some data from my application to an excel sheet, in the export, I also want to create a macro command and add a checkbox associated to that macro, but I got an error because of the :
Programmatic access to Visual Basic is not trusted
I can resolve the problem by checking the option directly in Excel, but it is not a good way to resolve a problem since, I wont be the one using the app...
Is there a way to programmaticly check the option in my VB code?
Re: Programmatic access to Visual Basic is not trusted
Sounds like you code is accessing the VBA IDE code? There is not way to "programmatically" check the "Trust" option.
Re: Programmatic access to Visual Basic is not trusted
Tx, that is what I was afraid of.
I thought there might have been a way by changing setting in the registry directly.
Re: Programmatic access to Visual Basic is not trusted
If there was a way, it would defeat the purpose of security for macros as code could run regardless of the users security settings, etc. ;)
Re: Programmatic access to Visual Basic is not trusted
Well, if by "check" you mean "click the checkbox", then yeah, I can see why that would be a security hole and hence it makes sense that it's not allowed. However, I found this thread because I was looking for a way to programmatically confirm the current setting (another definition of "check"... as in, to "check up on something"), and I get the impression that's not possible either. I'm trying to write a script that would create Macros if the user's security settings allowed, but if they didn't, it would quietly just not bother making any Macros rather than bombing out. Is there some way to peek in at the current setting programmatically?
Re: Programmatic access to Visual Basic is not trusted
rightly or wrongly you can change the security setting by editing the registry key, but not while excel is open
you can read the key to determine the security level while excel is open