I know some others have already come up with the “one line of code” that does this “refreshing of a document” using Live Office with Microsoft Office 2003 but as I discovered during a recent customer visit this platform is becoming fast obsolete and many people need another solution.
Therefore I attach the following 2 spreadsheets in the attached ZIP archive file which are based on the Efashion universe which allow the user to refresh a Live Office report using a VBA macro.
Instead of using the Microsoft Office object model this uses the crystal_enterpriseframework_addin.dll which is installed with every Live Office deployment.
Therefore the code will work with every version of Microsoft Office (2003-2010) and also with Business Objects XI 3.1 and SAP BI 4.
The first file - execute_live_office_refresh_embedded_macro_vba_box31.xlsm is for use with Business Objects XI Live Office 3.1.
(The Live Office query can be refreshed in the above file via a CTRL+R keyboard shortcut that triggers the report refresh)
The second file - execute_live_office_refresh_embedded_macro_vba_sapbi4.xlsm is for use with SAP Business Intelligence Platform 4.0.
(The Live Office query is refresh automatically in the SAP BI 4.0 version)
Please feel free to upload this if you find it’s useful and also let me know if you have any questions.
Only moderators can view attachments in this forum. You will be able to download the files once this submission is approved and moved to the Downloads forum.
This was exactly what I was looking for.
Where did you find the information to get you started? I’ll need some more VBA tricks interfacing with Live Office in a project of mine.
To me the correct solution to refresh all liveoffice objects in excel at once from the macro vba code was:
Application.COMAddIns(1).Object.liveObjects.Refresh True
To solve your message you will need to set the reference to the library that contains the object which the error message is complaining about.
If you do not know which library this is, you could open the original project from where you copied the code and see which libraries are referenced there.
That was the problem, and I’m getting closer to the solution. I found the library the code referenced, but that library isn’t in my other workbooks. I searched online to try to figure out how to copy the library over, but I can’t figure it out. Do you know how?
I am trying to use this macro with a live office object that has certain prompts binded to excel cells. It refreshes the document, but it is unable to account for the prompts that I bound. Do you know how I can fix this?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set lo.loevent = Nothing
End Sub
Public Sub Refresh_All()
Set lo.loevent = Application.COMAddIns(“CrystalOfficeAddins.CrystalComAddin.7”).Object
lo.loevent.LiveObjects.Refresh
End Sub
------code in Class Module
Public WithEvents loevent As CrystalAddin
Private Sub loevent_BeforeFunction(ByVal addinName As String, ByVal functionName As String, ByVal Parameters As CRYSTAL_ADDIN_FRAMEWORKLib.IParameters)
End Sub
Private Sub loevent_AfterFunction(ByVal addinName As String, ByVal functionName As String, ByVal Parameters As CRYSTAL_ADDIN_FRAMEWORKLib.IParameters)
If functionName = “RefreshAllViews” Or functionName = “Refresh_View” Then
I wrote this solution around 2 years or so ago now when I was still working with SAP Business Objects.
Unfortunately for those asking me to tweak the solution so it works for them or so that it works with the latest versions of SAP BO I am unable to do so as even though I still work in the BI arena I no longer work with SAP BO so am unable to even view/amend the original solution I wrote.