macshimi
11-09-2006, 05:07 AM
I have a UserForm which is used to print two copies of a document.
The user needs to repeat this for a user-specified number(TxtCnt) of documents and I do not know how to return control to the UserForm so that the next set of data can be entered.
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 cmdPrint_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.
The user needs to repeat this for a user-specified number(TxtCnt) of documents and I do not know how to return control to the UserForm so that the next set of data can be entered.
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 cmdPrint_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.