Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Programming [email protected] New Users to Excel 2 May 28th 08 08:38 PM
programming ernie Excel Discussion (Misc queries) 4 March 13th 06 02:06 PM
Programming help BB Excel Discussion (Misc queries) 3 December 5th 05 01:09 AM
Programming in VB Kamyk Excel Programming 2 July 8th 04 11:02 PM
Do I need programming for this? .NET Developer Excel Programming 2 August 18th 03 08:55 PM


All times are GMT +1. The time now is 07:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"