2 Replies Latest reply: Jan 23, 2016 2:39 AM by Thomas MacKay RSS

    VB Script saving and closing Qlikview app

    Rakul Alagu

      Hi,

      Someone help me with VB script that can open a Qlikview Document and save it and close it without any alert message. I m trying to create -prj folder using vb macro.

       

      Thanks,

      Rakul.

        • Re: VB Script saving and closing Qlikview app
          Thomas MacKay

          try this:

          Sub opennclose()

          pth = "C:\Users\macka\Desktop\gyhijk.qvw"

          Set qvdoc = application.OpenDocEx(pth, 1, 0)

          Dim oFSO

          Set oFSO = CreateObject("Scripting.FileSystemObject")

          oFSO.CreateFolder Left(pth, Len(pth) - 4) & "-prj"

          qvdoc.Save

          qvdoc.CloseDoc

          set oFSO = nothing

          End Sub

           

          you should be able to find out how to get a value into a macro elsewhere on the site so i won't go into that

          • Re: VB Script saving and closing Qlikview app
            Marcus Sommer

            I use these loop-routine for various export- and print-jobs and it should work for your task, too.

             

            sub AutomaticLoop

             

            dim doc, obj, iRow, app, path, newApp, newdoc

             

            set doc = ActiveDocument

            set obj = doc.GetSheetObject("TB01") 'tablebox with apps and full-paths

             

            for iRow = 1 to obj.GetRowCount - 1

                set app = obj.GetCell(iRow, 0) 'application

                set path = obj.GetCell(iRow, 1) 'path

             

                set newApp = ActiveDocument.GetApplication

                set newdoc = newApp.OpenDoc (path.Text & "\" & app.Text,"","")

                newdoc.GetApplication.WaitForIdle

                newdoc.closedoc

            next

             

            set obj = nothing

            set app = nothing

            set path = nothing

            set newApp = nothing

            set newdoc = nothing

             

            doc.GetApplication.Quit

                       

            end sub   

             

            - Marcus