ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to update a control without screen flashing (https://www.excelbanter.com/excel-programming/329786-how-update-control-without-screen-flashing.html)

Chaplain Doug

How to update a control without screen flashing
 
Excel 2003. I have a workbook I call "Switchboard" with multiple sheets. On
each sheet I have some controls, one of which is a text window that I use to
display the status of a program that is running as a result of pressing a
control button on the sheet. The code that is running does open some other
workbooks temporarily, but focus is retained by the "Switchboard" workbook.
However, when I try to update the status text control using the following
code, the other open workbooks flash up momentarily and then focus is
returned to the Switchboard workbook and sheet. How may I eliminate this
"flash"? Here's the code:

Public Sub UpdateStatus(UStatus As String)
Dim SUOff As Boolean
If Application.ScreenUpdating = False Then
SUOff = True
Application.ScreenUpdating = True
End If
ThisWorkbook.ActiveSheet.ProcessStatus.Value = UStatus
ThisWorkbook.ActiveSheet.ProcessStatus.Activate
If SUOff Then Application.ScreenUpdating = False
End Sub

The call would be "Call UpdateStatus("Processing workbook x")"
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org

Tom Ogilvy

How to update a control without screen flashing
 
IF the screen haschanged while updating is off and you turn it on, then
there is no way to avoid having the information in the screen updated which
I assume you are describing as a flash. As a general suggestion, I would
avoid selecting and activating things. Have your status window fill the
screen and only update when it is in the foreground.

--
Regards,
Tom Ogilvy



"Chaplain Doug" wrote in message
...
Excel 2003. I have a workbook I call "Switchboard" with multiple sheets.

On
each sheet I have some controls, one of which is a text window that I use

to
display the status of a program that is running as a result of pressing a
control button on the sheet. The code that is running does open some

other
workbooks temporarily, but focus is retained by the "Switchboard"

workbook.
However, when I try to update the status text control using the following
code, the other open workbooks flash up momentarily and then focus is
returned to the Switchboard workbook and sheet. How may I eliminate this
"flash"? Here's the code:

Public Sub UpdateStatus(UStatus As String)
Dim SUOff As Boolean
If Application.ScreenUpdating = False Then
SUOff = True
Application.ScreenUpdating = True
End If
ThisWorkbook.ActiveSheet.ProcessStatus.Value = UStatus
ThisWorkbook.ActiveSheet.ProcessStatus.Activate
If SUOff Then Application.ScreenUpdating = False
End Sub

The call would be "Call UpdateStatus("Processing workbook x")"
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org




Chaplain Doug

How to update a control without screen flashing
 
Tom:

Is there a way to ensure that my workbook maintains the focus at all times,
even though the code may open some other workbooks (which I do not want to
see)?

"Tom Ogilvy" wrote:

IF the screen haschanged while updating is off and you turn it on, then
there is no way to avoid having the information in the screen updated which
I assume you are describing as a flash. As a general suggestion, I would
avoid selecting and activating things. Have your status window fill the
screen and only update when it is in the foreground.

--
Regards,
Tom Ogilvy



"Chaplain Doug" wrote in message
...
Excel 2003. I have a workbook I call "Switchboard" with multiple sheets.

On
each sheet I have some controls, one of which is a text window that I use

to
display the status of a program that is running as a result of pressing a
control button on the sheet. The code that is running does open some

other
workbooks temporarily, but focus is retained by the "Switchboard"

workbook.
However, when I try to update the status text control using the following
code, the other open workbooks flash up momentarily and then focus is
returned to the Switchboard workbook and sheet. How may I eliminate this
"flash"? Here's the code:

Public Sub UpdateStatus(UStatus As String)
Dim SUOff As Boolean
If Application.ScreenUpdating = False Then
SUOff = True
Application.ScreenUpdating = True
End If
ThisWorkbook.ActiveSheet.ProcessStatus.Value = UStatus
ThisWorkbook.ActiveSheet.ProcessStatus.Activate
If SUOff Then Application.ScreenUpdating = False
End Sub

The call would be "Call UpdateStatus("Processing workbook x")"
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org





Chaplain Doug

How to update a control without screen flashing
 
Thanks Walt. Will try and report.

"Walt" wrote:

Hi Doug,

You might be able to work the following into your code just after opening
the files that you don't want to flash and while screenupdating is off:

ActiveWindow.Visible = False

Best Regards,
Walt Weber

"Chaplain Doug" wrote:

Excel 2003. I have a workbook I call "Switchboard" with multiple sheets. On
each sheet I have some controls, one of which is a text window that I use to
display the status of a program that is running as a result of pressing a
control button on the sheet. The code that is running does open some other
workbooks temporarily, but focus is retained by the "Switchboard" workbook.
However, when I try to update the status text control using the following
code, the other open workbooks flash up momentarily and then focus is
returned to the Switchboard workbook and sheet. How may I eliminate this
"flash"? Here's the code:

Public Sub UpdateStatus(UStatus As String)
Dim SUOff As Boolean
If Application.ScreenUpdating = False Then
SUOff = True
Application.ScreenUpdating = True
End If
ThisWorkbook.ActiveSheet.ProcessStatus.Value = UStatus
ThisWorkbook.ActiveSheet.ProcessStatus.Activate
If SUOff Then Application.ScreenUpdating = False
End Sub

The call would be "Call UpdateStatus("Processing workbook x")"
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


Walt[_3_]

How to update a control without screen flashing
 
Hi Doug,

You might be able to work the following into your code just after opening
the files that you don't want to flash and while screenupdating is off:

ActiveWindow.Visible = False

Best Regards,
Walt Weber

"Chaplain Doug" wrote:

Excel 2003. I have a workbook I call "Switchboard" with multiple sheets. On
each sheet I have some controls, one of which is a text window that I use to
display the status of a program that is running as a result of pressing a
control button on the sheet. The code that is running does open some other
workbooks temporarily, but focus is retained by the "Switchboard" workbook.
However, when I try to update the status text control using the following
code, the other open workbooks flash up momentarily and then focus is
returned to the Switchboard workbook and sheet. How may I eliminate this
"flash"? Here's the code:

Public Sub UpdateStatus(UStatus As String)
Dim SUOff As Boolean
If Application.ScreenUpdating = False Then
SUOff = True
Application.ScreenUpdating = True
End If
ThisWorkbook.ActiveSheet.ProcessStatus.Value = UStatus
ThisWorkbook.ActiveSheet.ProcessStatus.Activate
If SUOff Then Application.ScreenUpdating = False
End Sub

The call would be "Call UpdateStatus("Processing workbook x")"
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org



All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com