0 Replies Latest reply: Jan 22, 2014 7:17 PM by Sudhir Kamatkar RSS

    VBScript OpenDoc works inconsistently

      I have a simple VBScript written as follows. This is called from windows command prompt using
      command :  cscript -nologo mytest.vbs

       

      The mytest.vbs itself is simple as:

       

      ----- Start of mytest.vbs -------

       

      Dim qvwFile, objQV, docObj2

       

      WScript.Stdout.Write " Enter QVW File Path: "

      qvwFile = Wscript.StdIn.ReadLine

       

      Set objQV = CreateObject("QlikTech.QlikView")

       

      Wscript.Sleep 2000

      Wscript.Echo ("Opening qvwFile: " & Chr(34) & qvwFile & Chr(34))

       

      Set docObj2 = objQV.OpenDoc(Chr(34) & qvwFile & Chr(34))

      Wscript.Sleep 2000

       

      docObj2.Save

      docObj2.CloseDoc

      objQV.Quit

       

      ------ End of mytest.vbs --------------

       

      When run, gives error "mytest.vbs - Microsoft VBSCript runtime error: Object Required" at the line "docObj2.Save" .

       

      If I log off and log back in, it works. I noticed that if for some reason previous run of the script was unfinished or unsuccessful, it leaves something in memory that prohibits next run of this script to run successfully.

       

      Anyone else have similar experience? If so, what is cleaner solution?

       

      Thanks