New Excel Forum

This forum has been moved to TeachExcel.

Ask all future questions in the new excel forum.

ExcelKey

Using VBA to Write Code

Free Excel Tips and Tutorials
Forum rules
This forum is closed.

All new posts should be made at our new Excel Forum at TeachExcel.com.

Using VBA to Write Code

Postby Sisyphus » Sun May 27, 2012 11:55 pm

Yes, it is possible to write code that either writes code or amends code that is already written. However, I view this capability strictly as a developer tool - nothing that you install on every computer in your company. The reason is that, in order to write code into a project, you need access to that project. You can grant - or deny - such access in the Macro Security dialog box, 'Trusted Publishers' tab, and check/uncheck the box at the bottom that is marked 'Trust access to Visual Basic Project'.

Windows intentionally doesn't provide a method to set this little checkmark programmatically. It has to be done manually. Microsoft argues that, if a program could be used to set this checkmark, hackers could gain access to your VBA Projects and install whatever viruses they just invented directly into the 'brain' of your machine. Windows doesn't open either door or window to that nightmare. The only one who can is yourself. You put that checkmark there at your own risk.

Without such access to the VB Projects code can't be inserted into them. Therefore the practice of creating code on the fly isn't very wide-spread. The risks involved by far outweigh any possible benefits.
Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010

Return to Excel Tips and Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest