Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete a line of Code

Status
Not open for further replies.

JimCowan

Technical User
Jul 12, 2000
10
CA
Within an event procedure, how do I delete a line of code which would be executed once only, then deleted? Can it be done?
I am using Office 2000.
Thanks for any help
 
Rather then deleting the line of code try using a flag to set a condition then if the condition is true the line of code is executed else ignored.

Laters

Max:)
 
JohnYingling, I would be careful with this. POster did not say once per instantiation, the y said ONCE. The clue here MAY be that they are asking to DELETE the line of Code, which implies (STRONGLY) they mean once -PERIOD.

JimCowan

This gets to be much more complex than it appears at first glance. It can be done, but you need to be VERY careful. Using the modules collection, you would statrt w/ the name of the module where the procedure is located. You can get the Names of each procedure in the module, and the number of lines in the procedure (in several flavors). So, within the module / procedure, you would need to check the original line number of the line you want to delete, and see if it was -in fact- the line you want to delete and -if so, delete it. Else just do nothing.

A (perhaps) safer approach would be to place some key/value in the registry immediatly after the line was executed, and check the registry for the key / value before executing the line and -of course- skipping the line and the registry entry if the registry entry already exists.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top