Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
egoziyan
Contributor II
Contributor II

Vbscript error when trying to reload and export

G'day All,

I have a which shows today sales in a simple chart (pivot table) which I want to export to excell and send by email. after reading many posts here I have created a vbscript which open the QVW reload it, make the export and then execute a macro that send the email.

everything worked fine the first few times I have tested it but today when ever I run the vbscript I am getting the following error:

"Script:
c:\user\...\todaysales.vbs
Line: 4
Char:1
Error: Object required: 'ActiveDocument'
Code: 800A01A8
Source: Microsoft VBScript runtime error"

My script is:

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("D:\QlikView\Production\Model\Today_Sales\todaySales.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
Set obj = ActiveDocument.GetSheetObject("CH88")
Obj.ExportBiff "C:\temp\todayavaragesales.xls"
Set obj = ActiveDocument.GetSheetObject("CH92")
Obj.ExportBiff "C:\temp\todaysales.xls"
ActiveDocument.GetSheetObject("BU01").Press
ActiveDocument.Save

Set MyDoc = Nothing
MyApp.Quit
Set MyApp = Nothing

The only way to solve it is to restart the computer, but after running o.k for one time the error starting again.
I am using win 2008 server 64bit and running qlikview 9 SR5

Any help would be appreciated

10x in advance

6 Replies
egoziyan
Contributor II
Contributor II
Author

Attached a capture of the error message

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I may be wrong but this is what I suspect is happening.

  • You open MyDoc and then assign MyDoc to ActiveDocument
  • At the end you free up MyDoc, but not ActiveDocument

The assignment is essentially redundant. I would suggest that you delete the line "Set ActiveDocument = MyDoc" and change all the references to ActiveDocument to MyDoc.

Give that a shot and let us know whether that worked or not.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
egoziyan
Contributor II
Contributor II
Author

Hi Jonathan,

Thanks for your replay.

I have tries your suggestion but It didn't work and I am still getting the same error message.

Just to be sure I did ok you ment for this ?

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("D:\QlikView\Production\Model\Today_Sales\todaySales.qvw","","")
MyDoc.Reload
Set obj = MyDoc.GetSheetObject("CH88")
Obj.ExportBiff "C:\temp\todayavaragesales.xls"
Set obj = MyDoc.GetSheetObject("CH92")
Obj.ExportBiff "C:\temp\todaysales.xls"
MyDoc.GetSheetObject("BU01").Press
MyDoc.Save

Set MyDoc = Nothing
MyApp.Quit
Set MyApp = Nothing

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I am assuming that the error now refers to MyDoc rather than ActiveDocument.

It seems that the OpenDoc command is not successfully opening the QV document. This could be due to one of the following (which you may have already checked, but in case you havent):

  • the path is incorrect. Verify that the document exists at that location, and that the script is running on the same machine as the 😧 drive.
  • the document has section access, and you are not running the script in the correct user context (NTNAME section access), or it requires a username/password in the second and third parameters (not an empty string).
  • the document is unavailable due to active directory / NT security settings
  • lastly, and I hope not the case, the document is corrupted.
  • Something else I haven't thought of.

Can you open the document manually? Is the script running under your username?

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
james
Creator III
Creator III

Did anyone ever figure this out? I am receiving Object Required... Once I restart PC it runs once fine

11-9-2014 1-08-27 PM.jpg

cleite2014
Creator
Creator

Good Morning,

I am getting this same error in a VB script as well.  Is there a solution out there for this issue?

Thank you,

Craig Leite