Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default DoEvents and Semaphoring

Currently I have a sheet that uses a semaphore type code to keep constants
and classes in memory while the user uses the sheet. I have the code in the
workbook_open event, using a checkbox on a sheet to keep it going:

'Now keep system Idle so WBS never goes out of scope
While gcwbThis.Sheets("Control").chkRun.Value

DoEvents

'Now Check for any events
If ef.AddRow Or ef.DeleteRow Or ef.RefreshControl Or ef.ResetControl
Or _
ef.ControlActivate Or ef.ControlChange Or ef.WBSWorking Or _
ef.WBSCheckUncheck Then

'Turn off Screen updates
ScreenUpdating False

Control_Functions

WBS_Functions

ScreenUpdating True

End If

Wend

The only issue is that I cannot open another workbook via double-clicking or
activate an open workbook via clicking on it. I can open a workbook and
switch via the menu controls. Is there a flag or way that can tell me when
another sheet is attempting to open so I can allow it in, even when just
double-clicking on it?


--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default DoEvents and Semaphoring

I assume you have decided that you really need code like this running in a
loop and there is no <better way.

When you open an xls from Explorer, DDE is used to inform Excel that a WB
wants to open. I don't use DDE, but maybe look into one of those methods.
However, given the nature of you code, it may be better to isolate your
Excel instance from DDE with:
Application.IgnoreremoteRequests=True

NickHK

"J Streger" wrote in message
...
Currently I have a sheet that uses a semaphore type code to keep constants
and classes in memory while the user uses the sheet. I have the code in

the
workbook_open event, using a checkbox on a sheet to keep it going:

'Now keep system Idle so WBS never goes out of scope
While gcwbThis.Sheets("Control").chkRun.Value

DoEvents

'Now Check for any events
If ef.AddRow Or ef.DeleteRow Or ef.RefreshControl Or ef.ResetControl
Or _
ef.ControlActivate Or ef.ControlChange Or ef.WBSWorking Or _
ef.WBSCheckUncheck Then

'Turn off Screen updates
ScreenUpdating False

Control_Functions

WBS_Functions

ScreenUpdating True

End If

Wend

The only issue is that I cannot open another workbook via double-clicking

or
activate an open workbook via clicking on it. I can open a workbook and
switch via the menu controls. Is there a flag or way that can tell me when
another sheet is attempting to open so I can allow it in, even when just
double-clicking on it?


--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default DoEvents and Semaphoring

Thanks Nick. Seems to work just fine.

And the only reason is performance. Reloading the class objects each time is
time consuming and of course I'm looking for as little lag time as possible.

--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003



"NickHK" wrote:

I assume you have decided that you really need code like this running in a
loop and there is no <better way.

When you open an xls from Explorer, DDE is used to inform Excel that a WB
wants to open. I don't use DDE, but maybe look into one of those methods.
However, given the nature of you code, it may be better to isolate your
Excel instance from DDE with:
Application.IgnoreremoteRequests=True

NickHK

"J Streger" wrote in message
...
Currently I have a sheet that uses a semaphore type code to keep constants
and classes in memory while the user uses the sheet. I have the code in

the
workbook_open event, using a checkbox on a sheet to keep it going:

'Now keep system Idle so WBS never goes out of scope
While gcwbThis.Sheets("Control").chkRun.Value

DoEvents

'Now Check for any events
If ef.AddRow Or ef.DeleteRow Or ef.RefreshControl Or ef.ResetControl
Or _
ef.ControlActivate Or ef.ControlChange Or ef.WBSWorking Or _
ef.WBSCheckUncheck Then

'Turn off Screen updates
ScreenUpdating False

Control_Functions

WBS_Functions

ScreenUpdating True

End If

Wend

The only issue is that I cannot open another workbook via double-clicking

or
activate an open workbook via clicking on it. I can open a workbook and
switch via the menu controls. Is there a flag or way that can tell me when
another sheet is attempting to open so I can allow it in, even when just
double-clicking on it?


--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003




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
DoEvents Arne Hegefors Excel Programming 4 October 19th 06 02:13 PM
status update during program run -- DoEvents doesn't always work Mark VII Excel Programming 2 October 18th 06 08:06 PM
DoEvents?? Geoff Excel Programming 4 August 18th 05 03:23 PM
Doevents Application Alex J Excel Programming 1 November 30th 03 04:31 PM


All times are GMT +1. The time now is 04:56 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"