Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Simple Printing Issue

Hi All,

I am using the following Macro to Print the Report . Every thing is working fine if I am printing the report.

The issue is, After the Print Dialog window is opened if  we click on the Cancel  button of the Print Dialog window its redirecting to the Edit Module page.

sub print

setvar1 = ActiveDocument.Variables("vPrintChartID").getContent.string

set ss= ActiveDocument.GetSheetObject(setvar1)

Set val=ActiveDocument.Fields("SSR_SUBMISSION_YR").GetPossibleValues(20000)

set f = ActiveDocument.GetField("SSR_SUBMISSION_YR")

f.SelectPossible

Set fv=f.GetSelectedValues(10000)

                              for i = 0 to fv.Count-1

                              ActiveDocument.Fields("SSR_SUBMISSION_YR").Select fv.Item(i).Text

                              Set DD = ActiveDocument.GetSheetObject(setvar1).DialogPrint

ss.print

Next

end sub

Print Issue.PNG

If I click on the Cancel of the above Print Window its opening the Edit module page which is incorrect. I am not sure what is wrong with this Macro.

Request your help to overcome this issue.

Thanks in Advance...

Regards,

MSChakravarthy.

5 Replies
Anonymous
Not applicable
Author

I assume that it workes fine if click Print button.  What is the expectaition fron the Cancel button?  If there are no any special expectation, you can just add a line in your macro, anywhere before "print":

on error resume next

In this case, nothing will happen at all.

Regards,

Michael

Anonymous
Not applicable
Author

Hi Michael,

Thanks for your reply.

The result is same after adding the code "on error resume next"

The expectation is,  if I click on the Cancel button it should remain on the Sheet from where I have initiated the Print.

But now its redirecting to the Edit Module  Page.

Regards,

MSchakravarthy.

Anonymous
Not applicable
Author

Hi ,

Can any one suggest how to resolve this.

Regards,

MSChakravarthy.

Anonymous
Not applicable
Author

Could you please upload an example of your application?

marcus_sommer

I think if you press cancel it will return cancel on your variable DD - this is not an error. You must it to retrieve before ss.print and it is cancel exit sub.

- Marcus