Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a below macro in excel which opens a qlikview document "Reloads" the data in it and saves it but I am unable to close the same using the vba code.
Sub RefreshQlikviewfile ()
Dim Fname As String
Fname = ThisWorkbook.Sheets(3).Cells(2, 2).Value
Set QvDoc = GetObject(Fname)
QvDoc.Reload
QvDoc.Save
End Sub
I tried to use the below code lines but any of them didn't work.
1) QvDoc.Quit
2) QvDoc.Exit
3) QvDoc.Close
Please help...
Thanks a lot for your help in advance.[:)]
Try this:
set Qv = CreateObject("QlikTech.QlikView")
set QvDoc = Qv.OpenDocEx (Fname,0)
QvDoc.Reload
QvDoc.Save
QvDoc.CloseDoc
Qv.Quit
If that doesn't work, then there's some restriction with Excel that I'm not aware of. In which case, you would probably need to kill the QV.exe process after the save:
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& ".\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Qv.exe'")
For Each objProcess in colProcess
objProcess.Terminate()
Next
Regards,
Hi Vlad,
Thanks a lot it's working fine now.
Thanks a Ton..