I have a UserForm which is used to update a document and print two copies.
The user enters the number of docs to complete in a TexBox TxtCnt.
The For.. Next Statement works but control does not return to the UserForm
after printing. How do i do that?
This is a simplified version of the code (I have removed a lot of repetitive
lines):
Private Sub cmdOK_Click()
Dim strReason As String
Dim strType As String
Dim i As Integer
For i = 1 To TxtCnt.Value
If optReason1 = True Then strReason = "Actual Exit"
If optType1 = True Then strType = "Leaving Service"
Application.ScreenUpdating = False
UpdateBookmark "bmkID", txtID.Value
UpdateBookmark "bmkSur", txtSur.Value
Application.ScreenUpdating = True
ActiveDocument.PrintOut Copies:=2
optReason1.Value = True
optType1.Value = True
txtID.Value = Null
txtSur.Value = Null
Application.ScreenUpdating = True
Next i
End Sub
Thanks for any help you can offer.
Charles was telling us:
Charles nous racontait que :
> I have a UserForm which is used to update a document and print two
> copies. The user enters the number of docs to complete in a TexBox
[quoted text clipped - 35 lines]
>
> Thanks for any help you can offer.
You could hide it before launching the procedure and the Show it again
after.
Private Sub cmdOK_Click()
Dim strReason As String
Dim strType As String
Dim i As Integer
Me.Hide
For i = 1 To TxtCnt.Value
'Your code...
Next i
Me.Show
End Sub
Does that help?

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Charles - 10 Nov 2006 08:51 GMT
Hi Jean-Guy
Merci! As usal, a simple solution.
Regards
Charles
> Charles was telling us:
> Charles nous racontait que :
[quoted text clipped - 58 lines]
>
> Does that help?