Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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
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.
Hi ,
Can any one suggest how to resolve this.
Regards,
MSChakravarthy.
Could you please upload an example of your application?
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