4 Replies Latest reply: Apr 6, 2011 10:34 PM by Manoj Kumar Varatharajan RSS

    Macros not working in AJAX Zero FootPrint Browser client

    Manoj Kumar Varatharajan

      Hi,

      My Macro scripts for 'Export to PPT' and 'Print Sheet' works well in 'IE Plugin' Browser client. However, it is not working in 'AJAX zero foot print' Browser client. Please find below the Macros that I use in the document. Is there any solution to fix this issue?

      Macro 1:

      sub ExportToPPT
      Set PPApp = CreateObject("Powerpoint.Application")
      filename=InputBox("Enter FileName","SaveAs","UCB_MM_ExecutiveSummary")
      PPApp.Visible = True ' Create a presentation
      Set PPPres = PPApp.Presentations.Add
      set s=ActiveDocument.Sheets("Executive Summary")
      charts=s.GetGraphs
      Set PPSlide = PPPres.Slides.Add(1, 1)
      PPSlide.Shapes(1).Delete ' removes the title
      PPSlide.Shapes(1).Delete ' removes the text box
      for i=lbound(charts) to ubound(charts)
      Set PPSlide = PPPres.Slides.Add(1,1)
      PPSlide.Shapes(1).Delete ' removes the title
      PPSlide.Shapes(1).Delete ' removes the text box
      ActiveDocument.GetSheetObject(charts(i).getobjectid).CopyBitmapToClipboard
      PPSlide.Shapes.Paste
      PPSlide.Shapes(PPSlide.Shapes.Count).Left = 200
      PPSlide.Shapes(PPSlide.Shapes.Count).Top = 175
      next
      PPPres.SaveAs "C:\QlikView\PowerPoint"&filename&".ppt"
      PPPres.Close
      PPApp.Quit
      Set PPSlide = Nothing
      Set PPPres = Nothing
      Set PPApp = Nothing
      end sub

      Macro 2:

      Sub PrintCurrentSheet
      Set objWord = CreateObject("Word.Application")
      objWord.Visible = False
      Set objDoc = objWord.Documents.Add
      Const wdOrientLandscape = 1
      objDoc.PageSetup.Orientation = wdOrientLandscape
      ActiveDocument.ActiveSheet.CopyBitmapToClipboard false
      objWord.Selection.Paste
      Const wdAlignParagraphCenter = 1
      objDoc.Paragraphs(1).Alignment = wdAlignParagraphCenter
      objDoc.PrintOut()
      DO WHILE objWord.BackgroundPrintingStatus > 0
      LOOP
      objWord.Quit wdDoNotSaveChanges
      Set objWord = Nothing
      Set objDoc = Nothing
      END SUB

      Thanks,

      Manoj

        • Macros not working in AJAX Zero FootPrint Browser client
          Rakesh Mehta

          HI Manoj,

          Yes, not all the macros will work with AJAX client. You would have to find a workaround for what youare trying to do.

           

            • Macros not working in AJAX Zero FootPrint Browser client
              Manoj Kumar Varatharajan

              Hi Rakesh,

              Thank you for providing insight on AJAX client limitations. This is the first time I am working with AJAX client and had mentioned below the scenarios that needs to be handled using Macro. Please let me know if you can give me some directions.

              Scenario 1: Exporting Sheet Objects (mainly Gauges, Charts and Tables) to PowerPoint

              User need a button in every sheet to export the Chart Objects (as Bitmap) in PowerPoint and Save the file in specific location in the local drive. I tried this using following Macro which is not working in 'AJAX Zero Footprint' client.

              sub ExportToPPT
              Set PPApp = CreateObject("Powerpoint.Application")
              filename=InputBox("Enter FileName","SaveAs","UCB_MM_ExecutiveSummary")
              PPApp.Visible = True ' Create a presentation
              Set PPPres = PPApp.Presentations.Add
              set s=ActiveDocument.Sheets("Executive Summary")
              charts=s.GetGraphs
              Set PPSlide = PPPres.Slides.Add(1, 1)
              PPSlide.Shapes(1).Delete ' removes the title
              PPSlide.Shapes(1).Delete ' removes the text box
              for i=lbound(charts) to ubound(charts)
              Set PPSlide = PPPres.Slides.Add(1,1)
              PPSlide.Shapes(1).Delete ' removes the title
              PPSlide.Shapes(1).Delete ' removes the text box
              ActiveDocument.GetSheetObject(charts(i).getobjectid).CopyBitmapToClipboard
              PPSlide.Shapes.Paste
              PPSlide.Shapes(PPSlide.Shapes.Count).Left = 200
              PPSlide.Shapes(PPSlide.Shapes.Count).Top = 175
              next
              PPPres.SaveAs "C:\QlikView\PowerPoint\"&filename&".ppt"
              PPPres.Close
              PPApp.Quit
              Set PPSlide = Nothing
              Set PPPres = Nothing
              Set PPApp = Nothing
              end sub


              Scenario 2: User need a Print Button that prints the current sheet including the selections.

              I tried this by copying the current sheet in bitmap format and print in Landscape which works well in 'IE Plugin' and not in 'AJAX Zero Footprint' client. Macro used for this feature is mentioned below.

              Sub PrintCurrentSheet
              Set objWord = CreateObject("Word.Application")
              objWord.Visible = False
              Set objDoc = objWord.Documents.Add
              Const wdOrientLandscape = 1
              objDoc.PageSetup.Orientation = wdOrientLandscape
              ActiveDocument.ActiveSheet.CopyBitmapToClipboard false
              objWord.Selection.Paste
              Const wdAlignParagraphCenter = 1
              objDoc.Paragraphs(1).Alignment = wdAlignParagraphCenter
              objDoc.PrintOut()
              DO WHILE objWord.BackgroundPrintingStatus > 0
              LOOP
              objWord.Quit wdDoNotSaveChanges
              Set objWord = Nothing
              Set objDoc = Nothing
              end sub


              Thanks,

              Manoj