Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I tried to write a macro to export a chart image in MS XLS.
below the code:
Sub ExcelExpwCaption
'Set the path where the excel will be saved
filePath = "C:\Test.xls"
'Create the Excel spreadsheet
Set excelFile = CreateObject("Excel.Application")
excelFile.Visible = true
'Create the WorkBook
Set curWorkBook = excelFile.WorkBooks.Add
'Create the Sheet
Set curSheet = curWorkBook.WorkSheets(1)
'Get the chart we want to export
Set imageToExport = ActiveDocument.GetSheetObject("OV-GRAP1")
Set chartProperties = imageToExport.GetProperties
imageToExport.CopyBitmapToClipboard
'Get the caption
chartCaption = imageToExport.GetCaption.Name.v
'MsgBox chartCaption
'Set the first cell with the caption
curSheet.Range("A1") = chartCaption
'Paste the rest of the chart
curSheet.Paste curSheet.Range("A2")
excelFile.Visible = true
'
'Cleanup
Set curWorkBook = nothing
Set excelFile = nothing
End Sub
In descktop mode it works but in webview mode it doesn't work.
The question is : can this macro run on webview mode? if not, there is a different solution to fix it?
thanks in advance for your help
In AJAX Client Macros wont work. Please check with local Qlik support team for other alternatives.
As an altenative you can flip the order of control and let an Excel VBA control QlikView instead. An Excel VBA will be a much better environment to develop your code anyway by giving you full debugging and intellisense for the entire QlikView object model too.
To be precise: WebView and Ajax client mode are two different things. So essentially you have four clients for QlikView:
1) QlikView Desktop: using normal Windows Forms mode
2) QlikView Desktop using WebView: using Internet Explorer as web client
3) Internet Explorer plug-in: using the ActiveX object
4) Ajax: using only native functionality of each browser by using the light-weight Ajax library
to enable a full QlikView client experience in all the popular browsers
Option 1 and 2 can be used both directly with local QVW-files and as clients for running a server application.
Option 3 and 4 needs a server and can't use local QVW-files. So you will connect via the AccessPoint or directly
to a URL that still use the AccessPoint but allow you to skip the menu system of the AccessPoint.
It is only option 1 that gives you the full spectrum of VBScript (or JScript) macros. There are several limitations - most quite natural - when you use the other options and especially when you run on a server. All options allow some macro code to work. Qlik and Qlik employees strongly discourage any use of macros and to a certain extent I agree with them. But macros can solve real pressing needs for a developer - but should be avoided for end-user performance heavy calculations. Macros are not supported in any form in Qlik Sense. Automation and VBScript / VBA is very slow when it comes to massive data manipulation by its very nature and shouldn't be used for that.
it doesnot work have a look at this
but is there a simple Macro to enable WebView in a on/off state?
So that I can to automate turning it on or off via actions as a macro.
thanks all for yours help
Not true, if so none of our applications would work.
In WebView mode when developing macros don't work, but some macros will work in Ajax when the application is published.
If you want your code to work for your users they will have to use Plugin as client.
If they use Ajax (WebView) it will not work.
Simple as that. 🙂