If you have created an automatic link to another object, it updates whenever you open the entry. If the ProcessBook display is kept open, the object does not automatically update to the latest change. One workaround is to access the object via VBA and simulate reopening of the object. I tested out the below VBA on a bmp object, since I don't have a PDF control that can be linked. Hopefully this will be a good start for you.
Private Sub btnRefresh_Click() Dim oleObj As OLEObject Set oleObj = ThisDisplay.OLEObjects(1) oleObj.Close oleObj.Run End Sub
- You will want to modify the index for OLEObjects if you have more than one on your display.
- In the above example, the refresh is triggered by manually pressing a button. You can also put it in Display_DataUpdate event to allow this refresh to run automatically. The downside is that the script will be run every 5 seconds (by default), and your PDF is only updating once a day.
Hope it helps. Please let me know if you have any questions.
This thread has a lot of information about updating embedded objects in Processbook.
I have a similar use case. I was able to easily configure a string builder reference in AF that makes a dynamic link to a file based on a dynamic parameter and some folder syntax.
Now, how do I now use that string to create a button that will open a file at the location that is dynamically generated by AF?
It feels like this should be easy, but I'm not slamming it yet.
1. Create a value symbol referencing the string builder AF attribute. This will be called Value1.
2. Create a button symbol. This will be called Button1.
3. Copy and paste the following VBA code into the editor.
Private Sub Display_DataUpdate() Set def = Button1.GetDefinition() def.Action = Value1.GetValue(v, s) Button1.SetDefinition def Value1.Visible = False End Sub
The result is that the value symbol will be hidden and the button symbol will be updated with the value of the value symbol every time there is a data update.
Thanks Eugene! That did work...sort of. I couldn't create the button at first, since I didn't have anything to attach it to. It somehow worked. My problem then becomes, I'm trying to do this for three buttons. I tried the following code blocks, but they just don't seem to work. I created buttons 46 and 47 by copying button 45. The links seem to permanently point to button 45. I can't seem to toggle them to dynamically reference the proper values.
Any thoughts as to how I might get past this next hurdle? I feel like I'm pretty close!
Private Sub Display_DataUpdate()
Set def = Button45.GetDefinition()
def.Action = Value65.GetValue(v, s)
Value65.Visible = False
Private Sub Display_DataUpdate2()
Set def = Button46.GetDefinition()
def.Action = Value66.GetValue(v, s)
Value66.Visible = False
Private Sub Display_DataUpdate3()
Set def = Button47.GetDefinition()
def.Action = Value67.GetValue(v, s)
Value67.Visible = False
Ah. That is because you should put all your code in Display_DataUpdate() as that is the only sub that will get triggered automatically by Processbook.
Awesome, that worked. Thanks very much Eugene.
My only last question is, will this update sub always keep the sheet in an unsaved changes state?
Yes. Since the sub updates the action of the button. Therefore, the display should be saved if you want to keep the latest action.