Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
It is possible to make a macro that copy all of the content in 'Edit Script' (obviously for every sheet in script) and export to Word Document or another format? (Excel,txt,csv?)
I tried a different things, search in community and read API Guide but I didn't find anything. Is there any function that allows me to do it?
Thanks in advance,
Daniel
The script is contained in property
ActiveDocument.GetProperties.Script
So a quick macro to write the script from the current QVW to a text file could be:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile "C;\myfile.qvs", 2, True)
objTextFile.Write(ActiveDocument.GetProperties.Script)
objTextFile.Close()
If you download
Qlikview Cookbook: QVS Editor http://qlikviewcookbook.com/recipes/download-info/qvs-editor/
It contains macro code that reads & writes script.
-Rob
Yes, here you have some examples to excel and ppt (for word is similar)
The script is contained in property
ActiveDocument.GetProperties.Script
So a quick macro to write the script from the current QVW to a text file could be:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile "C;\myfile.qvs", 2, True)
objTextFile.Write(ActiveDocument.GetProperties.Script)
objTextFile.Close()
If you download
Qlikview Cookbook: QVS Editor http://qlikviewcookbook.com/recipes/download-info/qvs-editor/
It contains macro code that reads & writes script.
-Rob
is it possible to post the macro in the blog. I have the personal edition
Hi Rob,
I used the above snippet to create layout & script from my qvw files but in most of my files. I keep getting error in objTextFile.Write(ActiveDocument.GetProperties.Script) [Invalid procedure call or argument].It creates an empty file but is not able to write in the file. Its working if I use Admin access , I have read/write permission to the folder.
Sub SaveQvsLayout()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("E:\bb\analytics\qlikview\" & Right(replace(ActiveDocument.Name, ".qvw", ".qvs"),Len(ActiveDocument.Name)-InstrRev(ActiveDocument.Name,"\",-1)), 2, True)
objTextFile.Write(ActiveDocument.GetProperties.Script) 'Error-Invalid procedure call or argument
objTextFile.Close()
ActiveDocument.ExportLayoutFile("E:\bb\analytics\qlikview\" & Right(replace(ActiveDocument.Name, ".qvw", ".xml"),Len(ActiveDocument.Name)-InstrRev(ActiveDocument.Name,"\",-1)))
End Sub
So it's working if you open the qvw with Admin access? Why not open them all with Admin then. Or is that not possible?
-Rob
Hi Rob,
I am doing this to add all *.qvs/*.xml to version control. I have admin permissions but rest of the team doesn't so I wanted it to work for everyone. The only permission rest of the team doesn't have for E:\bb\analytics\qlikview\ is special permissions . I think that permission is responsible here I will try giving them that.
Thanks for the answer and that is really helpful Rob.
But When I am trying to executed the macro code that you have provided me I am getting follow error in my edit module window as ----- permission denied. Could you help me with some idea.
thank you.
You need to enable system-access within the modul security (left pane in the mid).
- Marcus
Thank you Marcus, that worked for me.