Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bluecarbon
Partner - Creator
Partner - Creator

VB Script saving and closing Qlikview app

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.

2 Replies
tmackay2015
Partner - Contributor III
Partner - Contributor III

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

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