Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Hi
I may be wrong but this is what I suspect is happening.
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
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
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):
Can you open the document manually? Is the script running under your username?
Jonathan
Did anyone ever figure this out? I am receiving Object Required... Once I restart PC it runs once fine
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