I'm creating a display with some VBA code, that:
1. Select relevant elements from AF structure with OLEDB
2. Go through these elements with changing the context of the element relative display
3. Save all displays as JPEG
4. Send it as email attachment
On the display I have SQC charts and values that are attributes either with Data reference: none or PI tags.
I have problem with the 2. or 3. point. After changing the context, the data on SQC charts and values with none data reference are updated on the exported JPEG, while Values pointing to attributes with PI tags are not.
But this only happen if I run it. If I put a breakpoint after context change or go through the code with f8, it works fine.
I use this code to set the context:
Sub SetContextElements(sContext As String) Dim myContext As ContextHandler Set myContext = Application.ContextHandlers("E") ' select element relative context handler myContext.CurrentContext(ThisDisplay) = sContext ' changes the context myContext.ContextUpdated ThisDisplay ' update? didn't see difference with or wothout it Application.Refresh ' also does not help ThisDisplay.Refresh ' also does not help End Sub
Does anyone know this problem?
Thank you for your help in advance.