12 Replies Latest reply: Jun 27, 2014 4:53 AM by Daniel Martin Jimenez RSS

    How to resolve macro parse failed when running it to the browser?

      Hi,

       

      I really don't know how to resolve this one,

       

      macroparse.png

       

      Note that, when I run it in the Qlikview Application/locally, there's no error found. But when I run/view it in the web, that message found! How can I eliminate or avoid or remove this one? I need help asap.

       

      Thanks for your ideas,

      Bill

        • Re: How to resolve macro parse failed when running it to the browser?
          Johannes Sunden

          You can add some Msgbox() :es in your code to see where the macro parsing fails to figure out what command is messing up the execution for you.

            • Re: How to resolve macro parse failed when running it to the browser?

              there's no error when you run it locally...

                • Re: How to resolve macro parse failed when running it to the browser?
                  Erich Shiino

                  Hi,

                  You can include some msgbox() in the middle of the code for debug in the browser...

                  If you add some of them you can isolate the lines where the error occurs.

                   

                  You can also post you code here so we can take a look and try to identify the problem

                  Regards,

                  Erich

                    • Re: How to resolve macro parse failed when running it to the browser?

                      THIS LINES OF CODES WORK WHEN I RUN MY QLIKVIEW LOCALLY, BUT WHEN I PUT IT ON THE SERVER, THE ERROR OCCURS

                       

                       

                      WHAT I WANT HERE IS THAT, SEND THE QVREPORTS INTO ONE EXCEL, EACH REPORTS HAS ONE SEPARATED SHEET

                      ============================================================================

                       

                      on error resume next

                      sub launchXL

                       

                                set oXL=CreateObject("Excel.Application")

                                oXL.visible=True

                                oXL.Workbooks.Add

                       

                                '---------------------------------------

                                aSheetObj=Array("MAgo26","MAgo25","MAgo24","MAgo23","MAgo22","MAgo21","MAgo20","MAgo19","MAgo18","MAgo17","MAgo16","MAgo15","MAgo14","MAgo13","MAgo12","MAgo11","MAgo10","MAgo9","MAgo8","MAgo7","MAgo6","MAgo5","MAgo4","MAgo3","MAgo2","MAgo1")

                                '---------------------------------------

                       

                                for i=0 to UBound(aSheetObj)

                                          oXL.Sheets.Add

                       

                                          Set oSH = oXL.ActiveSheet

                       

                                          'Getting the QView variable

                                          vCompany = ActiveDocument.Variables("vCompany").GetContent.String

                                          vTM = ActiveDocument.Variables("vTM").GetContent.String

                                          'vLM = ActiveDocument.Variables("vLM").GetContent.String

                       

                                          oXL.ActiveWorkbook.ActiveSheet.Cells(1, 1).Value = vCompany

                                          oXL.ActiveWorkbook.ActiveSheet.Range("A1:F1").Merge

                       

                                          if i >= 0 and i <= 16  then 'MAgo 10 to MAgo26

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = "Sales Analysis by District by Customer"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A2:F2").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(3, 1).Value = vTM & " vs MAgo"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A3:F3").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(4, 1).Value = ActiveDocument.GetSheetObject(aSheetObj(i)).GetCaption.Name.v

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A4:F4").Merge

                                          end if

                       

                                          if i = 17 then 'MAgo 9

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = "Sales Analysis by District by SKU"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A2:F2").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(3, 1).Value = vTM & " vs MAgo"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A3:F3").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(4, 1).Value = "Ranked by Volume"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A4:F4").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(5, 1).Value = ActiveDocument.GetSheetObject(aSheetObj(i)).GetCaption.Name.v

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A5:F5").Merge

                                          end if

                       

                                          if i = 21 or i = 20 or i = 19 or i = 18 then 'MAgo 5 to MAgo8

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = "Comparative Sales Volume by Customers"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A2:F2").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(3, 1).Value = vTM & " vs MAgo"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A3:F3").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(4, 1).Value = ActiveDocument.GetSheetObject(aSheetObj(i)).GetCaption.Name.v

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A4:F4").Merge

                                          end if

                       

                                          if i = 22 then 'MAgo 4

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = "Sales Analysis by Division by SKU"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A2:F2").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(3, 1).Value = vTM & " vs MAgo"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A3:F3").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(4, 1).Value = "Ranked by Volume"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A4:F4").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(5, 1).Value = ActiveDocument.GetSheetObject(aSheetObj(i)).GetCaption.Name.v

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A5:F5").Merge

                                          end if

                       

                                          if i = 23 then 'MAgo 3

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = "Comparative Sales Volume by Customers (Top 100)"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A2:F2").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(3, 1).Value = vTM & " vs MAgo"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A3:F3").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(4, 1).Value = ActiveDocument.GetSheetObject(aSheetObj(i)).GetCaption.Name.v

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A4:F4").Merge

                                          end if

                       

                                          if i = 24 then 'MAgo 2

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = "Sales Analysis"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A2:F2").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(3, 1).Value = vTM

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A3:F3").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(4, 1).Value = ActiveDocument.GetSheetObject(aSheetObj(i)).GetCaption.Name.v

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A4:F4").Merge

                                          end if

                       

                                          if i = 25 then 'MAgo 1

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = "Sales Analysis"

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A2:F2").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(3, 1).Value = vTM

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A3:F3").Merge

                       

                                                    oXL.ActiveWorkbook.ActiveSheet.Cells(4, 1).Value = ActiveDocument.GetSheetObject(aSheetObj(i)).GetCaption.Name.v

                                                    oXL.ActiveWorkbook.ActiveSheet.Range("A4:F4").Merge

                                          end if

                       

                                    oSH.Range("A6").Select

                       

                                    Set obj = ActiveDocument.GetSheetObject(aSheetObj(i))

                                    obj.CopyTableToClipboard True

                                    oSH.Paste

                                    sCaption=obj.GetCaption.Name.v

                                    set obj=Nothing

                       

                                          oSH.Rows("1:1").Select

                                          oXL.Selection.Font.Bold = True

                       

                                    oSH.Cells.Select

                                    oXL.Selection.Columns.AutoFit

                       

                       

                                    oSH.Range("A6").Select             

                                          oSH.Name=left(sCaption,30)

                       

                                          set oSH=Nothing

                       

                                next

                       

                                '---------------------------------------

                                set oXL=Nothing

                       

                       

                      end sub

                • Re: How to resolve macro parse failed when running it to the browser?
                  Bill Britt

                  What version of QVS are you running?

                   

                  Bill

                  • Re: How to resolve macro parse failed when running it to the browser?

                    For our users this means they chose the wrong permission settings the first time they opened the document.  I have seen posts where people edited a registry setting for this but..... we simply open the settings.ini on the users computer and remove the part that records macro setting information.

                     

                    EX:

                    [Module Checksums System]

                    E5D6D693-5357DBA0-779BD929-7EA91536-C9F92288=

                    8A2886FD-014D95FC-89430C6E-927D45DB-E6B48BAD=

                    ...

                     

                     

                    We remove the entire section about Module Checksums System.  Next entry of the document then gives a chance to set them again.  We typically set them for them at this point so we don't have to do this again.

                     

                     

                    Win7 location for settings.ini is under c:\users\username\appdata\...\qliktech\qlikview

                    WinXP location is c:\documents and settings\.....\qliktech\qlikview

                     

                     

                    HTH