printing problems: sometimes printed twice...
I have a big problem and cannot figure out what's wrong. Here is my code:
For I:=0 to GbDetail.Controlcount-1 do begin ///gbdetail is a TGroupBox
and I create checkboxes by code
if gbDetail.Controls[I] is TCheckbox then begin
with gbDetail.Controls[I] as TCheckBox do begin
if checked then begin
if not Lcheck then begin
TWordDocument(DetDocList.Items[I]).Activate;
if
TWordDocument(DetDocList.Items[I]).Application.Dialogs.Item(wdDialogFilePrin
t).Show(EmptyParam) = 0 then
exit
else
TWordDocument(DetDocList.Items[I]).printOut(BackGround);
Lcheck := True;
end else
TWordDocument(DetDocList.Items[I]).printOut(BackGround);
end;
end;
end;
end;
Sometimes it prints twice the first document, sometimes not !!! My goal is
to show only once the WdDialogFilePrint, select the printer and then print
all documents I have checked to the selected printer.
I tried to remove the printout after the selection of the printer, but in
that case, the program doesn't print the first document at all.
Please help me !!!
Bob