I'm looking for a working example of JScript macro's in a qvw .
The absence of any reference to JScript in manuals or fora makes me wonder if it's being used at all..
But isn't JScript superior to VBScript? (more functionallity, harder, better, faster, stronger..;-)
With kind regards,
Agree with both replies. Everybody is using VBScript. Even the Automation Reference is written entirely for VBScript. So, my recommendation - go with the flow 🙂 It always pays in the long run.
Another recommendation - use sparingly!Macros are a lot of fun, but also a lot of trouble. In my history of 4 major release upgrades (ever since QlikView 5), the only thing that I had to redo every single time is macros, because the API set is changing from one release to another.
I used Jscript in one of my frst applications and have regretted it ever since. You can't mix Jscript and VBS in the same document. The API examples, the code you get on this forum, from other examples -- it's all VBS and you have to go through a conversion effort to reuse it as Jscript. Ugh.
It's true that Jscript is much easier in some ways -- for example, array handling. But I've found that I use very few macros and they are quite simple so the language is no big deal.
Is it a mistake to say that Ajax does not support properly VBScript ?
Today I have a problem with a macro that works perfectly using IE Plugin and not with AJAX.
That macro just does a copytabletoclipboard and tries to copy it in an Excel spreadsheet.
Ce que je veux faire c'est copier des données de Qlikview (version ajax) dans un fichier Excel. Je sais que les Qlikview macros sont très limités dans ajax. J'ai ajouté du script au HTML mais cela ne me donne pas accès aux objets Qlikview. L'option Send to Excel ouvre un spreadsheet vierge avec un nom tiré au hasard. Je veux coller l'information dans le template que j'ai créé. Comment as-tu fait?
Voici l'exemple de macro utilisée.
set XLApp = CreateObject("Excel.Application") ' Open the Excel Application
XLApp.Visible = false
On Error Resume Next 'Make the Excel application visible or not (Test Purpose)
set XLDoc = XLApp.Workbooks.Add 'Create a Workbook
If (Err.Number > 0) Then
set v = ActiveDocument.Variables("DebugVariable")
v.SetContent Err.Number , 123
XLApp.Worksheets.Add().Name = 'TEST' ' Addition of sheets
set table = ActiveDocument.GetSheetObject( "CH62" )
for RowIter = 0 to table.GetRowCount-1
for ColIter =0 to table.GetColumnCount-1
set cell = table.GetCell(RowIter,ColIter)
XLApp.Worksheets("Overbook-Underbook (Protected)").Cells(RowIter +1, ColIter +1).Value = cell.Text
XLApp.Worksheets(1).Cells.EntireColumn.AutoFit 'Automatic Fit
XLApp.Worksheets(1).cells.WrapText = false 'Disable Wraping text
SaveFile=StrFileName & ";56"
On error resume next
If XLApp.Version < 12 then ' Excel Version Test
xlDoc.SaveAs StrFileName , 56
If Err.Number <> 0 then
GetEnvErr="ERROR: Unable to save " & StrFileName
xlApp.Close 'closes the workbook. "True" means that it saves modifications
xlApp.Quit 'closes excel. it's quite important