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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re: faq707-5757, Create User Form Using VBA

Status
Not open for further replies.

AncientBrit

Programmer
May 19, 2008
5
US
I could not find an answer to my question despite an extensive search, so my apologies if this has already been answered.

I'm making use of some of the code in the excellent FAQ707-5757, converting it for use with MS Project 2003.

I note that toward the end of the item, there is a line of code that reads:
Code:
.insertlines Line + 3, MyScript(0)
and I'm pretty certain it should read:
Code:
.insertlines Line + 1, MyScript(0)
Anyone any feedback please?

Best,

Peter
 






Hi,

Did you try it with the modification and without?

It seems that you are probably correct.

Just post a reply in the FAQ to the author, pointing out this aparent problem.

Skip,

[glasses]Just traded in my old subtlety...
for a brand NUANCE![tongue]
 
Thanks, Skip - I did send a comment to the author.

When I tested the code (partially modified to work within both MS Project and my own macro) it made no difference what value was used, and I think I know why - the first use attempts to insert code as line 3, but since there is no code in the handler at all, the insertion defaults to the first line.

Then the second insertion specifies line 2, which is now correct, because there is one line in there already.

Strictly, the value should be 1 and not 3, so that's what I'll use.

In the process, another oddity arose (discussed in another thread from 2006 - "Can't Enter Break Mode at this time Error", thread 46214) - I have two BREAKs inserted during and after the code in question, and when the macro is run, these produce an alert: "Can't enter break mode at this time".

This appears to be because the handler(s) for the form are being created programmatically.

Thanks for the helpful feedback,

Best,

Peter
 




Was there a question in there?

Skip,

[glasses]Just traded in my old subtlety...
for a brand NUANCE![tongue]
 
If there was, it's probably 'Can someone confirm my diagnosis with regard to the "Can't Enter Break Mode at this time Error"?'.

Best,

Peter
 




There are times when you cannot enter the break mode.

Why were you trying to enter the break mode?

Skip,

[glasses]Just traded in my old subtlety...
for a brand NUANCE![tongue]
 
My code is still in development and since a form, all its controls and handler routines (all created programmatically) are destined to be discarded upon completion, I needed to check the handler routines before they were deleted.

I had placed a Stop at the end of the procedure and toggled a breakpoint at the end of the For...Next loop that generates the handlers so that I could examine the state(s) of the temporary objects in the process of being created.

Since this is a conversion from Excel to Project I want to make sure that everything works smoothly before I hand the finished product over to the users.

By skipping the deletion I can see a snapshot of the end of the process, but that doesn't tell me what's going on in between the point that my code begins to create a series of Subs and the endpoint.

Although I'm working in a regulated environment this particular project is not intended to conform to regs, but it still has to be fully documented and explained as part of the audit trail for a product that will eventually be regulated.

This is the first time I've seen this error message - I wasn't aware that there were circumstances under which breakpoints wouldn't operate. (I've been programming since 1978 and I'm *still* learning :))

HTH,

Peter
 




You might put some Debug.Print statements in your code in lieu of breaks. I find it helpful to use a global DebugFlag that I can turn on & off to capture debug messages when necessary. View in the Immediate Window.

Skip,

[glasses]Just traded in my old subtlety...
for a brand NUANCE![tongue]
 
Got those :)

But they don't help when you need to view the code itself, while it's being generated.

I like being able to pull up an object I've created on the fly while it's still in context and examine different aspects of it to make sure it conforms to what I've modeled.

I must admit to being slightly puzzled by the necessity for the error; I wonder if anyone knows whether it also occurs in MSPJ2007 under similar circumstances?

I'd have thought at the very least it should be possible to view handlers even if simply as Read-Only. Maybe I'll find a way...

Useful to know, either way.

Best,

Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top