User Form Issues

K

Kenny

1. In my combobox1 click I need a stmnt to goto the next tab. The one I am
using also turns my num lock on and off?

2. I need to clear the controls in userform1 upon exit of the userform?

3. How do you BOLD a ref field for a bookmark?

4. How can I code hyphens to be placed in text placed in SSN spot and phone
number spot?

Thanks for the help!

Private Sub ComboBox1_Click()
SendKeys "{TAB}"
End Sub

Private Sub CommandButton1_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Select Case ComboBox1.Text
Case "Army"
Set oRng = oBMs("Locator").Range
oRng.Text = "HRC - Indianapolis" _
& vbCr & "ATTN: AHRC-ERP" & vbCr & "8899 East 56th Street" _
& vbCr & "Indianapolis, IN 46249-5301"
oBMs.Add "Locator", oRng
Case "Navy"
Set oRng = oBMs("Locator").Range
oRng.Text = "World Wide Locator" _
& vbCr & "Bureau of Naval Personnel" & vbCr & "PERS 312F" _
& vbCr & "5720 Integrity Drive" & vbCr & "Millington, TN 38055-3120"
oBMs.Add "Locator", oRng
Case "Air Force"
Set oRng = oBMs("Locator").Range
oRng.Text = "HQ AFPC/DPDXIDL" _
& vbCr & "550 C. Street West, Suite 50" & vbCr & "Randolph AFB, TX
78150-4752"
oBMs.Add "Locator", oRng
Case "Marines"
Set oRng = oBMs("Locator").Range
oRng.Text = "Headquarters USMC" _
& vbCr & "Personnel Management Support Branch (MMSB-17)" _
& vbCr & "2008 Elliot Road" & vbCr & "Quantico, VA 22134-5030"
oBMs.Add "Locator", oRng
End Select
Set oRng = oBMs("CustomersName").Range
oRng.Text = Me.TextBox1.Text
oBMs.Add "CustomersName", oRng
Set oRng = oBMs("AccountNumber").Range
oRng.Text = Me.TextBox2.Text
oBMs.Add "AccountNumber", oRng
Set oRng = oBMs("SocialNumber").Range
oRng.Text = Me.TextBox3.Text
oBMs.Add "SocialNumber", oRng
Set oRng = oBMs("CSRName").Range
oRng.Text = Me.TextBox4.Text
oBMs.Add "CSRName", oRng
Set oRng = oBMs("CSRPhone").Range
oRng.Text = Me.TextBox5.Text
oBMs.Add "CSRPhone", oRng
Set oRng = oBMs("Amount").Range
pastdue = Format$(Me.TextBox6.Text, "Currency")
oRng.Text = pastdue
oBMs.Add "Amount", oRng
ActiveDocument.Fields.Update
UserForm1.Hide
End Sub

Private Sub UserForm_Initialize()
ComboBox1.AddItem "Army"
ComboBox1.AddItem "Navy"
ComboBox1.AddItem "Air Force"
ComboBox1.AddItem "Marines"
ComboBox1.Style = fmStyleDropDownList
ComboBox1.BoundColumn = 0
ComboBox1.ListIndex = 0
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top