Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
Hi,
is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
Try adding a
doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
Hi Tom,
Thanks loads. I am not sure what you mean by "a doevents." Sounds like it is more complicated than simply adding the line "DoEvents." I tried the latter but it doesn't seem to help. The help info in MS help is unclear to me. So I would appreciate a bit more help. --- eugene "Tom Ogilvy" wrote: Try adding a doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
There is a command
DoEvents Simply add it somehwere in your code. eugene wrote: Hi Tom, Thanks loads. I am not sure what you mean by "a doevents." Sounds like it is more complicated than simply adding the line "DoEvents." I tried the latter but it doesn't seem to help. The help info in MS help is unclear to me. So I would appreciate a bit more help. --- eugene "Tom Ogilvy" wrote: Try adding a doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
Eugene,
Yes, all you would need to do is add: DoEvents wherever desired. This causes regular macro execution to take second priority while anything in the buffer - for example, repainting the screen, once that is done, the macro continues as normal. However, and correct me if I'm wrong Tom, but I know at least in past versions of XL I have noted that DoEvents does not always fire in code order, i.e. even though it may appear as the fourth or fifth instruction, it may fire first. At least I've had that issue before. To get around that, I put "DoEvents" in a second function by itself and call it when needed and this seems to ensure that it runs when ordered. For example: Sub Test_Program() <your code Call ExecuteDoEvents Application.ScreenUpdating <your other code End Sub Private Function ExecuteDoEvents() DoEvents End Function HTH "eugene" wrote: Hi Tom, Thanks loads. I am not sure what you mean by "a doevents." Sounds like it is more complicated than simply adding the line "DoEvents." I tried the latter but it doesn't seem to help. The help info in MS help is unclear to me. So I would appreciate a bit more help. --- eugene "Tom Ogilvy" wrote: Try adding a doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
As i know, DoEvents simply adds WM_PAINT message to windows queue.
So you are rights. Windows decides when to pass this message to application. XP wrote: Eugene, Yes, all you would need to do is add: DoEvents wherever desired. This causes regular macro execution to take second priority while anything in the buffer - for example, repainting the screen, once that is done, the macro continues as normal. However, and correct me if I'm wrong Tom, but I know at least in past versions of XL I have noted that DoEvents does not always fire in code order, i.e. even though it may appear as the fourth or fifth instruction, it may fire first. At least I've had that issue before. To get around that, I put "DoEvents" in a second function by itself and call it when needed and this seems to ensure that it runs when ordered. For example: Sub Test_Program() <your code Call ExecuteDoEvents Application.ScreenUpdating <your other code End Sub Private Function ExecuteDoEvents() DoEvents End Function HTH "eugene" wrote: Hi Tom, Thanks loads. I am not sure what you mean by "a doevents." Sounds like it is more complicated than simply adding the line "DoEvents." I tried the latter but it doesn't seem to help. The help info in MS help is unclear to me. So I would appreciate a bit more help. --- eugene "Tom Ogilvy" wrote: Try adding a doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
try it after the screenupdating then
Application.ScreenUpdating = True Doevents application.ScreenUpdating = False Doevents allow other processes to run during your code execution. It is often helpful in the situation you describe. -- Regards, Tom Ogilvy "eugene" wrote: Hi Tom, Thanks loads. I am not sure what you mean by "a doevents." Sounds like it is more complicated than simply adding the line "DoEvents." I tried the latter but it doesn't seem to help. The help info in MS help is unclear to me. So I would appreciate a bit more help. --- eugene "Tom Ogilvy" wrote: Try adding a doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
Hi witek and XP,
Thanks for the suggestions. But neither works. I guess I will have to struggle with code some more. Maybe there is a quirk in the loop that I have not been able to notice. If anyone can think of any other angle, please respond. I certainly won't feel bad stopping trying to fix my impossible code. -- eugene "XP" wrote: Eugene, Yes, all you would need to do is add: DoEvents wherever desired. This causes regular macro execution to take second priority while anything in the buffer - for example, repainting the screen, once that is done, the macro continues as normal. However, and correct me if I'm wrong Tom, but I know at least in past versions of XL I have noted that DoEvents does not always fire in code order, i.e. even though it may appear as the fourth or fifth instruction, it may fire first. At least I've had that issue before. To get around that, I put "DoEvents" in a second function by itself and call it when needed and this seems to ensure that it runs when ordered. For example: Sub Test_Program() <your code Call ExecuteDoEvents Application.ScreenUpdating <your other code End Sub Private Function ExecuteDoEvents() DoEvents End Function HTH "eugene" wrote: Hi Tom, Thanks loads. I am not sure what you mean by "a doevents." Sounds like it is more complicated than simply adding the line "DoEvents." I tried the latter but it doesn't seem to help. The help info in MS help is unclear to me. So I would appreciate a bit more help. --- eugene "Tom Ogilvy" wrote: Try adding a doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
Tom,
Your suggestion did fire some of the events that had until now not been shown. But not all of them. Back to work. Thanks again. -- eugene "Tom Ogilvy" wrote: try it after the screenupdating then Application.ScreenUpdating = True Doevents application.ScreenUpdating = False Doevents allow other processes to run during your code execution. It is often helpful in the situation you describe. -- Regards, Tom Ogilvy "eugene" wrote: Hi Tom, Thanks loads. I am not sure what you mean by "a doevents." Sounds like it is more complicated than simply adding the line "DoEvents." I tried the latter but it doesn't seem to help. The help info in MS help is unclear to me. So I would appreciate a bit more help. --- eugene "Tom Ogilvy" wrote: Try adding a doevents before setting screenupdating to True. -- Regards, Tom Ogilvy "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
screenupdating = true
Hi again,
After a considerable amount of tinkering, everything so far seems to work right. The result is so surprising, however, that I feel duty bound to share it with those who responded (and with members of the group who are generally so helpful). It is possible that there were, and still are, some quirks in my program. I have no way of knowing whether the tinkering I did with it had any effect on the final outcome. But after some restructuring of my program (reordering and streamlining), I decided to try DoEvents again. I tried all three suggestions mentioned in previous posts. Each helped something (that was true before restructuring as well). But none alone worked perfectly. There was always something wrong. A toggle button or a combo box or a text box did not update as it was supposed to. But since each suggested form of DoEvents seemed to help at least one problem, I decided it might be worth to try combinations. When two commands were used, things generally got better - but still not perfect. What did work, however, is a COMBINATION OF THREE COMMANDS - as such: Call ExecuteDoEvents DoEvents Application.ScreenUpdating = True DoEvents Application.ScreenUpdating = False The call is to the function suggested in XP's response: Private Function ExecuteDoEvents() DoEvents End Function The first two lines Call ExecuteDoEvents DoEvents seem to be entirely redundant. But I only get perfect display if both are there. I have no idea what is happening and my results may be unique to my program. But it does indicate that it is worth trying various things. One never knows what will please the computer monster. --- eugene "eugene" wrote: Hi, is anyone aware of whether Application.ScreenUpdating = True also updates settings on objects created using the control toolbox)? I am running into a problem where not everything on the screen updates all the time and from the pattern I am noticing, it seems that it always shows changes in the worksheet itself, but sometimes does not show changes to objects on the worksheet. Details: My program runs in two modes - "one screen at a time" or "loop through many screens." I set screenupdating to false no matter what. In "one screen at a time" mode, everything displays as it should at the end of each run. In this mode I don't explicitly update the screen but rely instead on the fact that the screen updates when the sub ends. In "loop through many screens" mode, I have the "do work" sub called from a looping macro. Now I explicitly state screenupdating = true at the end of each loop and I have a "wait" function that halts the running of the macro allows one to see the display for a short while. All the changes occur (I stepped through the code), but the display is not right. The worksheet changes are there, but changes made to something like the caption of a toggle button do not display. My code is extremely long and and won't run without the data residing in the worksheet. So I can't post it all. I am quite certain, however, that the problem has nothing to do with the code since everything works right when I step through the code. (In step into mode, the screen of course updates properly as it always does.) Is anyone out there aware of what the issue might be and how I might be able to fix it? -- eugene |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search for 2 true arguments and return true or false | Excel Discussion (Misc queries) | |||
Function to return True/False if all are validated as True by ISNU | Excel Worksheet Functions | |||
ScreenUpdating stays TRUE no matter what? | Excel Programming | |||
Screenupdating is always true | Excel Programming | |||
ScreenUpdating automatically resets to True | Excel Programming |