David,
As usual, I greatly appreciate your comments. However, I must tell you that it
is not a matter of opening EXCEL and waiting for it to initiate. I have waited
30 minutes, let alone 30 seconds, to fire up the macro and the results are the
same. Moreover, as I noted previously, this code executes flawlessly every time
when I fire it up on my laptop.
I'd still like to find a way to compare the initial state of EXCEL prior to
executing the macro on both machines. There must be something about the initial
state that causes one to consistently hang and the other not.
In any case, thanks again for your interest.
--- On Sat, 1/10/09, David Smart <smartware.consulting@...> wrote:
From: David Smart <smartware.consulting@...>
Subject: Re: [ms_excel] Tough Problem
To: ms_excel@yahoogroups.com
Date: Saturday, January 10, 2009, 8:53 PM
It's not that running the code with the break or stop initiates a
process.
What it does is to allow Excel to fully complete its initialisation. There
must be something in your code that needs this to happen.
Short of having your workbook in a running condition in my own development
environment, I do not have any further ideas on what to look for, sorry.
Maybe you simply need to make this a button-activated process that you run
once Excel has fully loaded. Or put in a delay that runs it after 30
seconds or so of opening the workbook.
Regards, Dave S
----- Original Message -----
From: "Lew Glenn" <lewglenn@yahoo. com>
To: <ms_excel@yahoogroup s.com>
Sent: Sunday, January 11, 2009 10:26 AM
Subject: Re: [ms_excel] Tough Problem
>I put the Stop as the first statement in MALBV as you suggested, then saved
>the code, exited EXCEL, and then restarted. I ran the code and, at each
>Stop, inspected the global variables. In every case the global variables
>had the correct values and the code executed correctly to conclusion. This
>is the same behavior that was obtained by setting the breakpoints. I then
>removed the Stop and reran the code 3 times; each time it ran correctly to
>conclusion.
>
> I then quit EXCEL, restarted, and attempted to run the code (without the
> Stop statement) and it hung --- the same behavior I noted earlier.
>
> It's clear that running the code with the break (or Stop) must initiate
> some process or state that, once initiated, allows the code to run
> correctly thereafter. Do you have any further suggestions for a
> workaround? I want to be able to reliably execute this code with an
> automatic scheduler so the presence of Stop statements won't work for me.
>
> --- On Fri, 1/9/09, David Smart <smartware.consultin g@...> wrote:
> From: David Smart <smartware.consultin g@...>
> Subject: Re: [ms_excel] Tough Problem
> To: ms_excel@yahoogroup s.com
> Date: Friday, January 9, 2009, 7:16 PM
>
>
>
>
>
>
>
>
>
>
>
> > > Have you had breakpoints give you reasonable numbers but
> the routine
>
>> > hang
>
>> > anyway?
>
>>
>
>> No.
>
>
>
> IIRC, your code in the previous subroutines is going out to the net to do
>
> things. Also, IIRC, the code in the MALBV subroutine looked pretty
> benign.
>
>
>
> I would be suspecting any code involved in setting the row limits,
>
> especially if it is any way related to external access outside Excel.
> There
>
> could well be a timing issue.
>
>
>
>> Where would I put the Stop?; at the same location where I put the
>
>> breakpoint(s) ?
>
>
>
> Yes. (Although I can't remember where you put the breakpoints, so this is
> a
>
> generic answer.)
>
>
>
>> And is there then a 'Resume' command which would continue the execution?
>
>
>
> The effect of a stop is the same as hitting a breakpoint. Therefore
>
> anything you can do to step/resume after a breakpoint you can do in
> exactly
>
> the same way after a stop. (There is no "resume" code, you do it all with
>
> the mouse as you would after a breakpoint.)
>
>
>
> The benefit is that the stop is actually in the code, so it will work in
>
> code being executed at Excel start-up.
>
>
>
> As a first test, I'd be putting the stop in as the very first statement in
>
> the MALBV subroutine and inspecting the module global variables for the
> min
>
> and max row limits when it stops there on the next open. Then click the
>
> "run macro" triangle to resume execution and see it if hangs. If the
> limits
>
> are OK and it hangs, then it must be MALBV somewhere, and you have the
>
> opportunity to set other breakpoints before the resume. If the limits are
>
> not OK, then it is something done previously.
>
>
>
> Regards, Dave S
>
>
>
> ----- Original Message -----
>
> From: "Lew Glenn" <lewglenn@yahoo. com>
>
> To: <ms_excel@yahoogrou p s.com>
>
> Sent: Saturday, January 10, 2009 11:30 AM
>
> Subject: Re: [ms_excel] Tough Problem
>
>
>
>> See my response to your queries below. I'm still troubled by the fact the
>
>> code runs fine on my laptop, even if I can kluge it to run with pseudo
>
>> breakpoints on my desktop. In your experience what could possibly cause
>
>> that behavior?
>
>>
>
>> Again, many thanks for your interest.
>
>>
>
>> Lew
>
>>
>
>> --- On Fri, 1/9/09, David Smart <smartware.consulti n g@...> wrote:
>
>> From: David Smart <smartware.consulti n g@...>
>
>> Subject: Re: [ms_excel] Tough Problem
>
>> To: ms_excel@yahoogroup s.com
>
>> Date: Friday, January 9, 2009, 1:44 PM
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> Problem with breakpoints is that you have to do them after
>
>> Excel has started
>
>>
>
>> and completed its initialisations. By that stage, the symptom might be
>
>>
>
>> gone.
>
>>
>
>>
>
>>
>
>> Have you had breakpoints give you reasonable numbers but the routine hang
>
>>
>
>> anyway?No. I put breakpoints at the first statement after 'rowmin = ...',
>
>> i.e., at 'Colopt = "F"' and at the End Sub statement. The correct values
>
>> for rowmin and rowmax are there in each case and the routine never hangs.
>
>> Moreover, after the execution completes this way, I can remove the
>
>> breakpoints and rerun the code (without debugger mode) and the code does
>
>> not hang --- and I can do this however many times I wish. If I then exit
>
>> EXCEL and restart & run the code (without debugger mode & the
>> breakpoints)
>
>> it always hangs.
>
>>
>
>>
>
>>
>
>> Another option is to put a Stop statement into the code and save the
>
>>
>
>> workbook. This will cause a breakpoint even on the initial execution of
>
>> the
>
>>
>
>> code.Where would I put the Stop?; at the same location where I put the
>
>> breakpoint(s) ? And is there then a 'Resume' command which would continue
>
>> the execution?
>
>>
>
>>
>
>>
>
>> Regards, Dave S
>
>>
>
>>
>
>>
>
>> ----- Original Message -----
>
>>
>
>> From: "Lew Glenn" <lewglenn@yahoo. com>
>
>>
>
>> To: <ms_excel@yahoogrou p s.com>
>
>>
>
>> Sent: Friday, January 09, 2009 10:24 AM
>
>>
>
>> Subject: Re: [ms_excel] Tough Problem
>
>>
>
>>
>
>>
>
>>> I'll try that, but note that when I put breakpoints at the beginning of
>
>>
>
>>> MALBV, the value of rowmin and rowmax are correct.
>
>>
>
>>>
>
>>
>
>>> Do you have ANY idea why this code executes correctly every time on my
>
>>
>
>>> laptop (both running XP and EXCEL 2007)? Is it possible that initial
>
>>
>
>>> settings when EXCEL boots are different? Is it possible to view EXCEL's
>
>>
>
>>> state variables immediately on initiation?
>
>>
>
>>>
>
>>
>
>>> Thanks for the suggestion.
>
>>
>
>>>
>
>>
>
>>> Lew
>
>>
>
>>>
>
>>
>
>>> --- On Thu, 1/8/09, David Smart <smartware.consulti n g@...>
>>> wrote:
>
>>
>
>>> From: David Smart <smartware.consulti n g@...>
>
>>
>
>>> Subject: Re: [ms_excel] Tough Problem
>
>>
>
>>> To: ms_excel@yahoogroup s.com
>
>>
>
>>> Date: Thursday, January 8, 2009, 2:51 PM
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I'm not seeing the problem either, but I note that the loop
>>> in
>
>>
>
>>> MALBV is
>
>>
>
>>>
>
>>
>
>>> dependent on global variables set in one of the previous subs.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> The problem might lie there, and MALBV might be trying to loop through a
>
>>
>
>>>
>
>>
>
>>> huge number of rows, and not giving you a chance to terminate it
>
>>
>
>>> gracefully.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Put the rowmin and rowmax values into the status bar before your start
>
>>> the
>
>>
>
>>>
>
>>
>
>>> FOR loops in MALBV. You might find that one or both of these has wrong
>
>>
>
>>>
>
>>
>
>>> values.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Regards, Dave S
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> ----- Original Message -----
>
>>
>
>>>
>
>>
>
>>> From: "Lew Glenn" <lewglenn@yahoo. com>
>
>>
>
>>>
>
>>
>
>>> To: <ms_excel@yahoogrou p s.com>
>
>>
>
>>>
>
>>
>
>>> Sent: Friday, January 09, 2009 4:31 AM
>
>>
>
>>>
>
>>
>
>>> Subject: Re: [ms_excel] Tough Problem
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>> If you look down at the code I included you will see than MALBV is a
>
>>
>
>>>
>
>>
>
>>>> subroutine that I wrote. It is not an add-in. And, as I pointed out, it
>
>>
>
>>>
>
>>
>
>>>> runs perfectly fine most of the time -- and always when I run this code
>
>>
>
>>>> on
>
>>
>
>>>
>
>>
>
>>>> my laptop.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> I've tried to find the problem with the debugger but every time I run
>
>>>> the
>
>>
>
>>>
>
>>
>
>>>> code with breakpoints in subroutine MALBV it executes mormally to
>
>>
>
>>>
>
>>
>
>>>> completion. The ONLY time the code seems to hang is when I first invoke
>
>>
>
>>>
>
>>
>
>>>> EXCEL and run without the debugger and without this subroutine
>>>> commented
>
>>
>
>>>
>
>>
>
>>>> out.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> Thanks for your comment.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Message trimmed
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> [Non-text portions of this message have been removed]
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> ------------ --------- --------- ------
>
>>
>
>>>
>
>>
>
>>> ---
>
>>
>
>>>
>
>>
>
>>> =========== Footer Revised 28 April 2006======== ==
>
>>
>
>>> PLEASE CHECK EXCEL HELP before posting a message to the forum
>
>>
>
>>> and ask SMART questions
>
>>
>
>>> http://www.catb. org/~esr/ faqs/smart- questions. html
>
>>
>
>>>
>
>>
>
>>> for normal live posts email <ms_excel-normal@ yahoogroups. com>
>
>>
>
>>> for digest email <ms_excel-digest@ yahoogroups. com>
>
>>
>
>>> for no mail email <ms_excel-nomail@ yahoogroups. com>
>
>>
>
>>> To UNSUBSCRIBE email <ms_excel-unsubscri b e@yahoogroups. com>
>
>>
>
>>> ============ ========= ========= ========= ========= =========
>
>>> =====Yahoo!
>
>>
>
>>> Groups Links
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> [Non-text portions of this message have been removed]
>
>>
>
>>
>
>> ------------ --------- --------- ------
>
>>
>
>> ---
>
>>
>
>> =========== Footer Revised 28 April 2006======== ==
>
>> PLEASE CHECK EXCEL HELP before posting a message to the forum
>
>> and ask SMART questions
>
>> http://www.catb. org/~esr/ faqs/smart- questions. html
>
>>
>
>> for normal live posts email <ms_excel-normal@ yahoogroups. com>
>
>> for digest email <ms_excel-digest@ yahoogroups. com>
>
>> for no mail email <ms_excel-nomail@ yahoogroups. com>
>
>> To UNSUBSCRIBE email <ms_excel-unsubscri b e@yahoogroups. com>
>
>> ============ ========= ========= ========= ========= =========
>> =====Yahoo!
>
>> Groups Links
>
>>
>
>>
>
>>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
> ------------ --------- --------- ------
>
> ---
>
> =========== Footer Revised 28 April 2006======== ==
> PLEASE CHECK EXCEL HELP before posting a message to the forum
> and ask SMART questions
> http://www.catb. org/~esr/ faqs/smart- questions. html
>
> for normal live posts email <ms_excel-normal@ yahoogroups. com>
> for digest email <ms_excel-digest@ yahoogroups. com>
> for no mail email <ms_excel-nomail@ yahoogroups. com>
> To UNSUBSCRIBE email <ms_excel-unsubscrib e@yahoogroups. com>
> ============ ========= ========= ========= ========= ========= =====Yahoo!
> Groups Links
>
>
>
[Non-text portions of this message have been removed]