Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel VBA Macro stops running when another program is activated

Using a dual processor machine running windows 2000 using excel 2000, I run a
vba script that takes a while to complete. The task was taking exceptionally
long to complete, so I looked at the task manager to see how much CPU power
excel was using.

When the VBA editor is the active window, excel uses 50% of the processing
power (1 full processor), however, as soon as another non excel window is
activated, the cpu usage for excel drops to 0% (ie it stops running).

How do I get excel to run VBA scripts when it is NOT the active application?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Excel VBA Macro stops running when another program is activated

This is what I think is happening - the other non-excel window is bound to
the same CPU as the excel window and so it's blocking excel from running.
So, what you have to do is bind the non-excel window to one CPU and excel to
the other CPU. You do this manually by opening Task Manager, Processes and
then right clicking on the process and then "Set Affinity". There is a way
to do this programatically using VBA and the Windows API but I do not have
that code with me.

Give that a try and post back, if it works or not.


--
www.alignment-systems.com


"Brody" wrote:

Using a dual processor machine running windows 2000 using excel 2000, I run a
vba script that takes a while to complete. The task was taking exceptionally
long to complete, so I looked at the task manager to see how much CPU power
excel was using.

When the VBA editor is the active window, excel uses 50% of the processing
power (1 full processor), however, as soon as another non excel window is
activated, the cpu usage for excel drops to 0% (ie it stops running).

How do I get excel to run VBA scripts when it is NOT the active application?

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel VBA Macro stops running when another program is activate

Thanks for the help, unfortunately it hasn't solved the problem yet.

I tried setting the affinity to both and either cpu with no effect. The
non-excel window doesn't have to use much cpu power (ie just activating the
task manager window will stop excel), both cpu's are idle until I re-activate
the excel window.

If there are any other suggestions I would appreciate it.

Thanks


"John.Greenan" wrote:

This is what I think is happening - the other non-excel window is bound to
the same CPU as the excel window and so it's blocking excel from running.
So, what you have to do is bind the non-excel window to one CPU and excel to
the other CPU. You do this manually by opening Task Manager, Processes and
then right clicking on the process and then "Set Affinity". There is a way
to do this programatically using VBA and the Windows API but I do not have
that code with me.

Give that a try and post back, if it works or not.


--
www.alignment-systems.com


"Brody" wrote:

Using a dual processor machine running windows 2000 using excel 2000, I run a
vba script that takes a while to complete. The task was taking exceptionally
long to complete, so I looked at the task manager to see how much CPU power
excel was using.

When the VBA editor is the active window, excel uses 50% of the processing
power (1 full processor), however, as soon as another non excel window is
activated, the cpu usage for excel drops to 0% (ie it stops running).

How do I get excel to run VBA scripts when it is NOT the active application?

Thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Excel VBA Macro stops running when another program is activate

Hi Brody,

This sounds like the code may be a bit screwy. Can you post some? Does the
code use focus ??


--
www.alignment-systems.com


"Brody" wrote:

Thanks for the help, unfortunately it hasn't solved the problem yet.

I tried setting the affinity to both and either cpu with no effect. The
non-excel window doesn't have to use much cpu power (ie just activating the
task manager window will stop excel), both cpu's are idle until I re-activate
the excel window.

If there are any other suggestions I would appreciate it.

Thanks


"John.Greenan" wrote:

This is what I think is happening - the other non-excel window is bound to
the same CPU as the excel window and so it's blocking excel from running.
So, what you have to do is bind the non-excel window to one CPU and excel to
the other CPU. You do this manually by opening Task Manager, Processes and
then right clicking on the process and then "Set Affinity". There is a way
to do this programatically using VBA and the Windows API but I do not have
that code with me.

Give that a try and post back, if it works or not.


--
www.alignment-systems.com


"Brody" wrote:

Using a dual processor machine running windows 2000 using excel 2000, I run a
vba script that takes a while to complete. The task was taking exceptionally
long to complete, so I looked at the task manager to see how much CPU power
excel was using.

When the VBA editor is the active window, excel uses 50% of the processing
power (1 full processor), however, as soon as another non excel window is
activated, the cpu usage for excel drops to 0% (ie it stops running).

How do I get excel to run VBA scripts when it is NOT the active application?

Thank you

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel VBA Macro stops running when another program is activate

Here is the most common loop in the code:

-----------------------------------------------------------------
Worksheets.Application.ScreenUpdating = False

Dim cur_cell As Range

Set cur_cell = Cells.Find(What:="A", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False)
While Not cur_cell Is Nothing
cur_cell.Offset(, -1).Activate
cur_cell.Delete Shift:=xlToLeft
Set cur_cell = Cells.Find(What:="A", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False)
Wend
Worksheets.Application.ScreenUpdating = True

-----------------------------------------------------------------------------------------
I turned off screen updating because it was going pretty slow with it on

"John.Greenan" wrote:

Hi Brody,

This sounds like the code may be a bit screwy. Can you post some? Does the
code use focus ??


--
www.alignment-systems.com


"Brody" wrote:

Thanks for the help, unfortunately it hasn't solved the problem yet.

I tried setting the affinity to both and either cpu with no effect. The
non-excel window doesn't have to use much cpu power (ie just activating the
task manager window will stop excel), both cpu's are idle until I re-activate
the excel window.

If there are any other suggestions I would appreciate it.

Thanks


"John.Greenan" wrote:

This is what I think is happening - the other non-excel window is bound to
the same CPU as the excel window and so it's blocking excel from running.
So, what you have to do is bind the non-excel window to one CPU and excel to
the other CPU. You do this manually by opening Task Manager, Processes and
then right clicking on the process and then "Set Affinity". There is a way
to do this programatically using VBA and the Windows API but I do not have
that code with me.

Give that a try and post back, if it works or not.


--
www.alignment-systems.com


"Brody" wrote:

Using a dual processor machine running windows 2000 using excel 2000, I run a
vba script that takes a while to complete. The task was taking exceptionally
long to complete, so I looked at the task manager to see how much CPU power
excel was using.

When the VBA editor is the active window, excel uses 50% of the processing
power (1 full processor), however, as soon as another non excel window is
activated, the cpu usage for excel drops to 0% (ie it stops running).

How do I get excel to run VBA scripts when it is NOT the active application?

Thank you



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel VBA Macro stops running when another program is activate

I have been able to work around the problem, although I do not know the
source. When starting the macro from the VB editor, the problem persists,
however, if the macro is started from the excel spreadsheet, I am able to
switch active windows to another application without causing the macro to
pause running.

Brody

"Brody" wrote:

Here is the most common loop in the code:

-----------------------------------------------------------------
Worksheets.Application.ScreenUpdating = False

Dim cur_cell As Range

Set cur_cell = Cells.Find(What:="A", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False)
While Not cur_cell Is Nothing
cur_cell.Offset(, -1).Activate
cur_cell.Delete Shift:=xlToLeft
Set cur_cell = Cells.Find(What:="A", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False)
Wend
Worksheets.Application.ScreenUpdating = True

-----------------------------------------------------------------------------------------
I turned off screen updating because it was going pretty slow with it on

"John.Greenan" wrote:

Hi Brody,

This sounds like the code may be a bit screwy. Can you post some? Does the
code use focus ??


--
www.alignment-systems.com


"Brody" wrote:

Thanks for the help, unfortunately it hasn't solved the problem yet.

I tried setting the affinity to both and either cpu with no effect. The
non-excel window doesn't have to use much cpu power (ie just activating the
task manager window will stop excel), both cpu's are idle until I re-activate
the excel window.

If there are any other suggestions I would appreciate it.

Thanks


"John.Greenan" wrote:

This is what I think is happening - the other non-excel window is bound to
the same CPU as the excel window and so it's blocking excel from running.
So, what you have to do is bind the non-excel window to one CPU and excel to
the other CPU. You do this manually by opening Task Manager, Processes and
then right clicking on the process and then "Set Affinity". There is a way
to do this programatically using VBA and the Windows API but I do not have
that code with me.

Give that a try and post back, if it works or not.


--
www.alignment-systems.com


"Brody" wrote:

Using a dual processor machine running windows 2000 using excel 2000, I run a
vba script that takes a while to complete. The task was taking exceptionally
long to complete, so I looked at the task manager to see how much CPU power
excel was using.

When the VBA editor is the active window, excel uses 50% of the processing
power (1 full processor), however, as soon as another non excel window is
activated, the cpu usage for excel drops to 0% (ie it stops running).

How do I get excel to run VBA scripts when it is NOT the active application?

Thank you

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
Excel functions not available then program stops K Excel Discussion (Misc queries) 0 August 20th 09 07:49 PM
why excel stops running?? usiddiqi Excel Discussion (Misc queries) 2 May 17th 06 10:14 AM
VBA Stops Before competing the program ch Excel Programming 3 February 14th 06 03:25 PM
Program calling up Excel - Not running Macro kraljb[_4_] Excel Programming 1 May 28th 05 06:23 AM
Macro stops running after file has moved LWhite Excel Programming 1 January 4th 05 07:44 PM


All times are GMT +1. The time now is 03:53 PM.

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"