Okay it seems it could be solved by changing time on the Values:
a = ThisDisplay.Value4.SetTimeRange("*-1d", "*")
Also if you don't care if the timerange of your whole display is updated, this can be more easier:
a = ThisDisplay.SetTimeRange("*-1d", "*")
I've just got a better tip:
a = DoEvents()
This works fine without any additional effect
the use of DoEvents in VBA will allow the UI to be refresh, basically your code will stop to leave the time to the hosting application (e.g. Excel or PI ProcessBook) to refresh the screen and process other events that may have occurred in the code.
In you case, since you are exporting the display as .jpg, this makes sense. Because you need a refreshed UI before the picture gets generated.
DoEvents is worth to use every X iterations in a long and expensive loops, so the user don't see the screen as frozen. If you are using objects such as progress bars, DoEvents is also mandatory otherwise you wont see the progress.
Basically, VBA is closely bounded to the UI thread so this is why it is necessary to think about refreshing the screen once in a while with the DoEvents.
You made a good find
Thanks for sharing!