Hi guys,
I have a userform with a button labeled 'Submit'. When this button is pressed it populates cells within my worksheet with data within text boxes on the userform.
I would also like the same button to bring up an email template, to be sent to a particular email address, an to have fields populated with the same data.
The email address will always be the same no matter what.
The code I have at the moment is:
How can I manipulate this code to do what I want?
I would also like a print button on the userform whereby when pressed the same data from the userfom populates fields in a word doc for me to print.
Cheers guys.
I have a userform with a button labeled 'Submit'. When this button is pressed it populates cells within my worksheet with data within text boxes on the userform.
I would also like the same button to bring up an email template, to be sent to a particular email address, an to have fields populated with the same data.
The email address will always be the same no matter what.
The code I have at the moment is:
Code:
Private Sub cmdSubmit_Click()
ActiveWorkbook.Sheets("SIRs").Activate
Range("C6").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtSIRNo.Value
ActiveCell.Offset(0, 1) = txtDescription.Value
ActiveCell.Offset(0, 2) = txtSNOW.Value
ActiveCell.Offset(0, 3) = txtOriginator.Value
ActiveCell.Offset(0, 4) = txtItem.Value
ActiveCell.Offset(0, 5) = txtSerNo.Value
ActiveCell.Offset(0, 6) = txtPartNo.Value
ActiveCell.Offset(0, 7) = txtDate.Value
ActiveCell.Offset(0, 8) = txtStartTime.Value
ActiveCell.Offset(0, 10) = txtStopTime.Value
ActiveCell.Offset(0, 12) = txtConditions.Value
ActiveCell.Offset(0, 13) = txtDowntimeItem.Value
ActiveCell.Offset(0, 14) = txtDowntimeFPDS.Value
ActiveCell.Offset(0, 15) = txtReplacement.Value
ActiveCell.Offset(0, 16) = txtTask.Value
ActiveCell.Offset(0, 17) = txtError.Value
ActiveCell.Offset(0, 18) = txtMethod.Value
ActiveCell.Offset(0, 19) = txtAction.Value
ActiveCell.Offset(0, 20) = txtHandbookReference.Value
ActiveCell.Offset(0, 21) = txtProcedure.Value
ActiveCell.Offset(0, 22) = txtIssues.Value
ActiveCell.Offset(0, 23) = txtAttachments.Value
ActiveCell.Offset(0, 24) = txtRank.Value
ActiveCell.Offset(0, 25) = txtInformation.Value
ActiveCell.Offset(0, 26) = txtContinuation.Value
If opInoperable = True Then
ActiveCell.Offset(0, 9).Value = "Inoperable"
ElseIf opDegraded = True Then
ActiveCell.Offset(0, 9).Value = "Degraded"
Else
ActiveCell.Offset(0, 9).Value = "Unaffected"
End If
If opSparesYes = True Then
ActiveCell.Offset(0, 11).Value = "Yes"
Else
ActiveCell.Offset(0, 11).Value = "No"
End If
Range("C6").Select
Unload Me
End Sub
I would also like a print button on the userform whereby when pressed the same data from the userfom populates fields in a word doc for me to print.
Cheers guys.