Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro parse failed

Hi,

I'm trying to implement a dynamic cyclic group. Therefore I have created a little macro which should do the trick. Problem is that the macro is running in QlikView client without any issues but not using a browser.

The macro code is kind of simple like this:

Sub DynamicGroup
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.RemoveGroup "CyclicGroup1"
Set gr = ActiveDocument.CreateGroup("CyclicGroup1")
gr.AddField "Field1"
gr.AddField "Field2"
dim x(2)
set gp = ActiveDocument.GetGroup("CyclicGroup1").GetProperties
x(1) = "FIELD1"
x(2) = "FIELD2"
gp.Labels = x
gp.IsCyclic = true
ActiveDocument.GetGroup("CyclicGroup1").SetProperties gp
ActiveDocument.GetApplication.Refresh
End Sub

When I run this macro in the client there is no problem but when I run it in the browser then I get the error message:

Macro parse failed. Functionality was lost
DynamicGroup
Error: Object needed 'gr'

I'm running QlikView 9 SR7.

Can anyone help me with this?

Regards

25 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi,

I am not sure, but i dont think you can create cyclic group in IE.

I have once tried to create cyclic grp(not by macro) through chart properties but the edit group button was disabled.

Not applicable
Author

If it wouldn#t be possible I'm wondering why it should be possible to remove a cyclic group because the first line of the macro removes the group before it is recreated.

And the group is definitely not usable after the macro has been executed so I guess it must be something other.

But that is just a conclusion from my point of view. Does anyone know a possibility to get an "official" answer to this?

Regards

Miguel_Angel_Baeyens

Hi,

Are both client and server running same version of QlikView?

Regards.

Not applicable
Author

hi im getting the same Macro Parse Failed message. I set up a post and still awaiting help.

http://community.qlik.com/forums/t/42978.aspx

Good luck.

Not applicable
Author

HI,

just to make sure I have just reinstalled the QlikView plugin on my machine and I'm still getting the error.

Any further idea?

Reagrds

Miguel_Angel_Baeyens

You're right.

Let's see what other users say, but it seems to me a bug here to be reported to QlikTech support.

Not applicable
Author


Miguel Angel Baeyens wrote:
You're right.


Does this mean you can reproduce the error at your site and think that it should be possible to create a cyclic using a macro through the plugin?

Regards

Miguel_Angel_Baeyens

Hello,

If the macro doesn't work, it should be triggered by pressing the button (similar to what happens when your macro saves the document, for example).

But in this case (I'm using 10 SR1) the macro triggers and starts working, but it stops in this place, (because of creating fields permissions? don't think so, using section access works as expected as well).

EDIT: The group is actually removed, then created, but fields are not added to that group, even using one dimension.

Not applicable
Author

Hi Miguel,

Heres my macro script:

----------------------------------------------------------------------------------------------------------

Sub SubmitQuestionnaire

Set oXL=CreateObject("Excel.Application")

'set doc = ActiveDocument
'set mySelection = doc.fields("User").GetSelectedValues
'for i = 0 to mySelection.Count -1
'strIndex = mySelection.Item(i).text
'next

strIndex = ActiveDocument.Variables("Username").GetContent.String


set DATA1 = ActiveDocument.GetApplication.GetProperties
VarHolder1 = now()
set temp = ActiveDocument.GetApplication.GetProperties
VarHolder2 = mid(temp.UserName,4)
set vCommentsToExcel = ActiveDocument.Variables("vUserEmail")
VarHolder3 = vCommentsToExcel.GetContent.String
set vCommentsToExcel = ActiveDocument.Variables("vUserPhone")
VarHolder4 = vCommentsToExcel.GetContent.String
set vCommentsToExcel = ActiveDocument.Variables("Quest1Answer")
VarHolder5 = vCommentsToExcel.GetContent.String
set vCommentsToExcel = ActiveDocument.Variables("Quest2Answer")
VarHolder6 = vCommentsToExcel.GetContent.String
set vCommentsToExcel = ActiveDocument.Variables("Quest3Answer")
VarHolder7 = vCommentsToExcel.GetContent.String
set vCommentsToExcel = ActiveDocument.Variables("vOtherFeedback")
VarHolder8 = vCommentsToExcel.GetContent.String

f_name = "\\Nmh-bus01\QVDataSource\QlikView Questionnaires\Question Answers.xls"
set oWB = oXL.Workbooks.Open(f_name)
set oSH = oWB.Worksheets.Item(1)

With oWB.Worksheets.Item(1).Range("a1:a1000")
Set c = .Find(strIndex, , , 2, 1, 2, 0)
If Not c Is Nothing Then
firstAddress = c.Address
Do
VarHolder = VarHolder + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With

if VarHolder = 100 then
msgbox("It appears you have already submitted a questionnaire. To resubmit please delete old questionnaire?")
oWB.Close

set oSH = Nothing
set oWB = nothing
set oXL = nothing

'CLEAR SELECTIONS IF QUESTIONNAIRE ALREADY SUBMITTED
set v = ActiveDocument.Variables("vUserEmail")
v.SetContent "",true
set v = ActiveDocument.Variables("vUserPhone")
v.SetContent "",true
set v = ActiveDocument.Variables("Quest1Answer")
v.SetContent "",true
set v = ActiveDocument.Variables("Quest2Answer")
v.SetContent "",true
set v = ActiveDocument.Variables("Quest3Answer")
v.SetContent "",true
set v = ActiveDocument.Variables("vOtherFeedback")
v.SetContent "",true
exit sub
else

'PASTE THE VALUES INTO EXCEL SHEET SPECIFIED
'username index
oSH.Range("A65536").End(-4162).Offset(1,0).FormulaR1C1 = strIndex
'date submitted
oSH.Range("A65536").End(-4162).Offset(0,1).FormulaR1C1 = VarHolder1
'user login
oSH.Range("A65536").End(-4162).Offset(0,2).FormulaR1C1 = VarHolder2
'optional user contact details
oSH.Range("A65536").End(-4162).Offset(0,3).FormulaR1C1 = VarHolder3
oSH.Range("A65536").End(-4162).Offset(0,4).FormulaR1C1 = VarHolder4
'question answers 1-3
oSH.Range("A65536").End(-4162).Offset(0,5).FormulaR1C1 = VarHolder5
oSH.Range("A65536").End(-4162).Offset(0,6).FormulaR1C1 = VarHolder6
oSH.Range("A65536").End(-4162).Offset(0,7).FormulaR1C1 = VarHolder7
'additional feedback
oSH.Range("A65536").End(-4162).Offset(0,8).FormulaR1C1 = VarHolder8

If f_name="False" then

Set oXL=nothing
Exit sub
End If

oWB.Save
oWB.Close

Set oSH=nothing
Set oWB=nothing
Set oXL=nothing

'CLEAR SELECTIONS AFTER SUBMISSION
set v = ActiveDocument.Variables("vUserEmail")
v.SetContent "",true
set v = ActiveDocument.Variables("vUserPhone")
v.SetContent "",true
set v = ActiveDocument.Variables("Quest1Answer")
v.SetContent "",true
set v = ActiveDocument.Variables("Quest2Answer")
v.SetContent "",true
set v = ActiveDocument.Variables("Quest3Answer")
v.SetContent "",true
set v = ActiveDocument.Variables("vOtherFeedback")
v.SetContent "",true

msgbox("Thank you for completing the 'March 2011 - QlikView Questionnaire. Your answers will be reflected in the next report refresh.")
'ActiveDocument.Reload
ActiveDocument.ClearAll
'ActiveDocument.CloseDoc
'App.OpenDoc "http://nmh-vapps03/QvAJAXZfc/AccessPoint.aspx?open=&id=QVS@nmh-vapps03%7CCorporate/User%20Guidance/Orientation%20page.qvw&client=Plugin"

end if
End Sub

-------------------------------------------------------------------------------

As you can see there are many 'set' attributes in the script if i remove these it wont work.

Is this a QlikView 9 bug?