Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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.
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
Hi Manoj
Your #2 should work fine out-of-the-box. It could be that you may have some permission problems where temporary print file gets created. Check QEMC for print directory and make sure that coming from URL you/user can reach that directory. If you search AJAX and Print here in community, you should find it. I remember to see it in someone's post.
For #1, you may always extract and generate document at the time of reload and email it, instead of user generating it. The problem is that with AJAX most of the things are running on the client-side javascript, and you ill not be able to do much on the server side, unless there is a native API from QlikView.
Hope this helps.
Rakesh
Hi Rakesh,
Thank you again for your immediate response. I followed these links http://community.qlik.com/forums/t/24843.aspx and http://community.qlik.com/forums/t/40004.aspx to figure out the Print Settings, however unable to locate in QlikView EnterPrise Management console >>> System >>> Setup >>> Qlikview Server. Am I missing anything in my QV 10 Server installation?
Regards,
Manoj