Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: George Evans   on Oct 10 In MS Office Category.

  
Question Answered By: Laura Rodriguez   on Oct 10

I've done a lot of this and there are some shortcomings!

Reporting lines of code  is not a problem but I'm sure that the VBA
compiler/interpreter gets it's panties twisted if you try to alter the code
you are actually running. This seems to occur if you alter code in the same
module so I think that "it" probably keeps a pointer to the line of code
it's working on so that it can come back to it after it's been on it's
travels. If you insert  code above this then there are all sortsa problems!
If you insert code below then you maaaay upset the pointers to a procedure
being run at a later stage.

I've written code to sort a set of Dim statements in a procedure and that
worked pretty well soooo my thinking is that if you keep the same number of
bytes between two places then you are ok.

Best practice I've found is to alter the code from another project even.

The calls to get lines of code are pretty straight forward and reasonably
documented. You can read a block of code or go down line by line.

If you need more I may be able to find some of that - very old... sorry -
code for you, but it's a great excersize to figure it out for yourself. If
you do want the code it won't be quick 'coz I have to look back quite a
way... Again sorry.

Once I tried to write  something that would write code to run itself and then
run it!! I don't remember why now... But it didn't work. If I restarted the
application running the written procedure worked fine though.

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on writing vba code to generate vba code Or get search suggestion and latest updates.


Tagged: