Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming to VBE
There is no way, other than using SendKeys (unreliable and not
recommended for production code) to programatically protect and unprotect the VBProject. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ajit" wrote in message ... I am working on a situation where there are couple of hundred excel templates with forms , modules etc. And i need to make a global change in the code to one of the procedure. I found some valuable information at www.cpearson.com which helped me pragramme to the Visual basic editor. What i am doing is : I am opening the required template, finding the procedure which needs to be replaced , deleting that procedure and adding a new procedure with same name but different code. All works well....except when VBE project is protected. Could someone suggest a wayout to unprotect the project at runtime ...make the required changes and then again protect the project before saving it. Suggestions will be highly appreciated. Thanks -- Ajit |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming to VBE
Hi Chip,
Why is it considered as unreliable and what does production code mean? Regards, Hari India "Chip Pearson" wrote in message ... There is no way, other than using SendKeys (unreliable and not recommended for production code) to programatically protect and unprotect the VBProject. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ajit" wrote in message ... I am working on a situation where there are couple of hundred excel templates with forms , modules etc. And i need to make a global change in the code to one of the procedure. I found some valuable information at www.cpearson.com which helped me pragramme to the Visual basic editor. What i am doing is : I am opening the required template, finding the procedure which needs to be replaced , deleting that procedure and adding a new procedure with same name but different code. All works well....except when VBE project is protected. Could someone suggest a wayout to unprotect the project at runtime ...make the required changes and then again protect the project before saving it. Suggestions will be highly appreciated. Thanks -- Ajit |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming to VBE
The success of sendkeys is dependent on what is active on the screen and
where the focus is at the time the keys are sent. As long as you can guarantee that this will aways be the same and the keys will be interpreted as intended, then it should be reliable. As much as you can't guarantee this, then it won't be reliable. Assume you are trying to sendkeys to a commandbar and someone has altered the commandbar - then you may get unexpected results. Production code means code provided as a product or to be executed by the "user" community. Generally you would want this to be as robust and reliable as possible. Because of the above considerations, sendkeys isn't really considered reliable in most cases. -- Regards, Tom Ogilvy "Hari" wrote in message ... Hi Chip, Why is it considered as unreliable and what does production code mean? Regards, Hari India "Chip Pearson" wrote in message ... There is no way, other than using SendKeys (unreliable and not recommended for production code) to programatically protect and unprotect the VBProject. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ajit" wrote in message ... I am working on a situation where there are couple of hundred excel templates with forms , modules etc. And i need to make a global change in the code to one of the procedure. I found some valuable information at www.cpearson.com which helped me pragramme to the Visual basic editor. What i am doing is : I am opening the required template, finding the procedure which needs to be replaced , deleting that procedure and adding a new procedure with same name but different code. All works well....except when VBE project is protected. Could someone suggest a wayout to unprotect the project at runtime ...make the required changes and then again protect the project before saving it. Suggestions will be highly appreciated. Thanks -- Ajit |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA Programming | New Users to Excel | |||
programming | Excel Discussion (Misc queries) | |||
Programming help | Excel Discussion (Misc queries) | |||
Programming in VB | Excel Programming | |||
Do I need programming for this? | Excel Programming |