Thanks for taking the time to reply. I dont have a signature block
setup, and since Im very new to all this Im unsure how to apply this to
my code.
I have inserted the code to my form, and perhaps you can see how it is
running. I dont want anything inserted into the header, I basically
just want the selections from the listbox "To be approved by:" to have
a signature line created for each one independantly. So if I select 3
or 4 list box entries, the code will create the appropriate # of
signature lines requiring those people to sign the document. The lines
can appear at the end of the document. Im not sure how to create a
signature block.
Take a look at this, and let me know what you think, and how I can
proceed. I really need to get this done.
<CODE>
Private Sub cmdOK_Click()
Dim Departments As String, Approvals As String, OrigDepartment As
String
Application.ScreenUpdating = True
With Me
If IsDate(txtEffectiveDate.Text) Then
.txtEffectiveDate.Text = Format(.txtEffectiveDate.Text, "mm/dd/yyyy")
Else
MsgBox .txtEffectiveDate.Text & " is not a valid Effective Date
format."
With .txtEffectiveDate
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
Exit Sub
End If
End With
'With Me
'If IsDate(txtReplaceDate.Text) Then
' .txtReplaceDate.Text = Format(.txtReplaceDate.Text, "mm/dd/yyyy")
'Else
' MsgBox .txtReplaceDate.Text & " is not a valid Replacement Date
format."
' With .txtReplaceDate
' .SetFocus
' .SelStart = 0
' .SelLength = Len(.Text)
' End With
' Exit Sub
' End If
'End With
Departments = ""
Approvals = ""
OrigDepartment = ""
For x = 0 To lstDepartments.ListCount - 1
If lstDepartments.Selected(x) Then
Departments = Departments & ", " & lstDepartments.List(x)
End If
Next
For x = 0 To lstApprovals.ListCount - 1
If lstApprovals.Selected(x) Then
Approvals = Approvals & ", " & lstApprovals.List(x)
End If
Next
For x = 0 To lstOrigDepartment.ListCount - 1
If lstOrigDepartment.Selected(x) Then
OrigDepartment = OrigDepartment & ", " &
lstOrigDepartment.List(x)
End If
Next
Departments = Mid(Departments, 3) 'Strip the initial comma and space
Approvals = Mid(Approvals, 3)
OrigDepartment = Mid(OrigDepartment, 3)
UpdateBookmark "bmAffectedDepartments", Departments
UpdateBookmark "bmPolicyDesc", txtPolicyDesc
UpdateBookmark "bmEffectiveDate", txtEffectiveDate
UpdateBookmark "bmApproved", Approvals
UpdateBookmark "bmReplaceDate", txtReplaceDate
UpdateBookmark "bmDepartments", OrigDepartment
UserForm1.Hide
Unload Me
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdClear_Click()
UpdateBookmark "bmApproved", ""
UpdateBookmark "bmAffectedDepartments", ""
UpdateBookmark "bmDepartments", ""
UpdateBookmark "bmPolicyDesc", ""
UpdateBookmark "bmEffectiveDate", ""
UpdateBookmark "bmReplaceDate", ""
For x = 0 To lstDepartments.ListCount - 1
lstDepartments.Selected(x) = False
Next
For x = 0 To lstApprovals.ListCount - 1
lstApprovals.Selected(x) = False
Next
For x = 0 To lstOrigDepartment.ListCount - 1
lstOrigDepartment.Selected(x) = False
Next
txtPolicyDesc.Value = Null
txtEffectiveDate.Value = Null
ScreenUpdating = True
End Sub
Private Sub UserForm_Initialize()
lstDepartments.List = Array("All Departments", "Accounts Payable",
"Accounts Receivable", "Administration", "ICG Admin", "ICG
Engineering", "ICG Field OPs", "ICG Proj. Mgmt.", "Operations",
"Rentals", "Service", "Warehouse")
lstApprovals.List = Array("President", "Director of Finance", "Director
of ICG", "Director of Sales-PAV", "Director of Sales-SAS", "Accounting
Mgr.", "Engineering Mgr.", "Field OPs.", "HR Mgr.", "Inside Sales
Mgr.", "IS Mgr.", "Marketing Mgr.", "Operations Mgr.", "Rental & Tech.
Services Mgr.", "Warehouse Mgr.")
lstOrigDepartment.List = Array("Accounts Payable", "Accounts
Receivable", "Administration", "ICG Admin", "ICG Engineering", "ICG
Field OPs", "ICG Proj. Mgmt.", "Operations", "Rentals", "Service",
"Warehouse")
End Sub
Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub
</CODE>