I’m trying to export a series of objects (charts) from a server .qvw via an external VB script. It's a straightforward section of code for this output, and it works with 4 out of 5 objects, however the 5th object throws the error of ‘object variable not set’ if there is no error handling in place. The first 4 objects are document objects, visible to all users on each session, whereas the 5th is a shared server object with the object ID format “CHxx-xx”.
The idea is this is part of a larger piece of automation to export objects daily as pivot tables/straight tables via a shared drive to a number of external users who do not have access to QV
The extract of code is as below:
For i = 1 To 5
Set QVObj = QVDoc.GetSheetObject(ObjectWs.Cells(i, 3).Value)
On Error Resume Next
ExportFilePath = "C:\Users\HOLLAND\QVObjects\" & ObjectWs.Cells(i, 3).Value & ".csv"
ExportFileName = ObjectWs.Cells(i, 3).Value & ".csv"
The 5 objects (listed in order on ObjectWs) are:
All 5 objects exist as when I export the CH46-02 object manually, the prefix on the resultant .csv is CH46-02.
I must be missing something minor, but is there a separate object command I need to be using? ‘GetSheetObject’ works fine for the first 4, but fails for the 5th, I know it doesn’t exist but it feels like ‘GetServerObject’ method is required instead, or something similar?
Any help greatly appreciated!