Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro is not connecting to R

Hi,

I wrote am macro as below:

1. Copy the chart properties and paste it to excel.

2. Connect to R and convert the excel data into JPG image.

3.Reload the script

Macro is as below:

Sub Test

XlsPath = "c:\lab\patient.xls"
'Create excel File
MsgBox("1")
Set objExcel = CreateObject("Excel.Application")

Set objWorkbook = objExcel.Workbooks.Add()

Set objWorksheet = objWorkbook.Worksheets(1)

'ActiveDocument.GetSheetObject( "CH148" ).CopyTableToClipboard true

set table = ActiveDocument.GetSheetObject( "CH148" )

'DIm array(7,2)
For RowIter = 0 to table.GetRowCount-1
For ColIter = 0 to table.GetColumnCount-1
set cell = table.GetCell(RowIter,ColIter)
'array(RowIter,ColIter)=cell.Text
objWorksheet.Cells(RowIter+1,ColIter+1).Value=cell.Text
'Msgbox(cell.Text)
Next
Next

objWorkbook.Saveas XlsPath
MsgBox("2")
objWorkbook.close
objExcel.quit

Set R = CreateObject("StatConnectorSrv.StatConnector")
R.Init "R"
MsgBox("Hi")
R.EvaluateNoReturn "source('C:/lab/Commands.R')"
MsgBox("Hi2")
ActiveDocument.Reload()

End Sub .

In my desktop its working fine.

But when I place the same qvw in accesspoint, macro is not connectign to R.

I opened the QVW file with 'IE plug in' only.

Please help ASAP.


0 Replies