#1   Report Post  
Posted to microsoft.public.word.docmanagement
Kenny Kenny is offline
external usenet poster
 
Posts: 23
Default User Form Problems

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






  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default User Form Problems

1. Use the Change event with this code:

Me.TextBox1.SetFocus

2. Change UserForm1.Hide to Unload Me

3. Use a CharFormat switch. e.g., { REF "CustomersName" \*CharFormat }
and apply bold formatting to the "R" in "REF"

4. Use the Format Method. e.g., oRng.Text = Format(Me.TextBox3.Text,
"###-##-####")
and oRng.Text = Format(Me.TextBox5.Text, "(###) ###-####")

You might be interested in UserForm data validation. See:

http://gregmaxey.mvps.org/Validate_U..._TextEntry.htm


Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Kenny wrote:
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



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Kenny Kenny is offline
external usenet poster
 
Posts: 23
Default User Form Problems

Thanks so much, works great!
How can I populate the formatting of the ssn or phone number back to the
textbox, after change?


"Greg Maxey" wrote:

1. Use the Change event with this code:

Me.TextBox1.SetFocus

2. Change UserForm1.Hide to Unload Me

3. Use a CharFormat switch. e.g., { REF "CustomersName" \*CharFormat }
and apply bold formatting to the "R" in "REF"

4. Use the Format Method. e.g., oRng.Text = Format(Me.TextBox3.Text,
"###-##-####")
and oRng.Text = Format(Me.TextBox5.Text, "(###) ###-####")

You might be interested in UserForm data validation. See:

http://gregmaxey.mvps.org/Validate_U..._TextEntry.htm


Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Kenny wrote:
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




  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default User Form Problems

Use the Exit event.
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox1.Text = Format(Me.TextBox1.Text, "###-##-####")
End Sub

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Kenny wrote:
Thanks so much, works great!
How can I populate the formatting of the ssn or phone number back to
the textbox, after change?


"Greg Maxey" wrote:

1. Use the Change event with this code:

Me.TextBox1.SetFocus

2. Change UserForm1.Hide to Unload Me

3. Use a CharFormat switch. e.g., { REF "CustomersName"
\*CharFormat } and apply bold formatting to the "R" in "REF"

4. Use the Format Method. e.g., oRng.Text = Format(Me.TextBox3.Text,
"###-##-####")
and oRng.Text = Format(Me.TextBox5.Text, "(###) ###-####")

You might be interested in UserForm data validation. See:

http://gregmaxey.mvps.org/Validate_U..._TextEntry.htm


Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Kenny wrote:
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



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Kenny Kenny is offline
external usenet poster
 
Posts: 23
Default User Form Problems

Thanks Greg!!!! Youy Rock!!!! Okay this is almost done I am learning so much.
One last question "I hope". On the document itself. How can you make the
Service Member: and Social Number: and Account Number: right justify so the
colons are line up. I tried to create a tab stop and right justify off of it.
It does not transfer it from the template to the new document? Is this
possible?


"Greg Maxey" wrote:

Use the Exit event.
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox1.Text = Format(Me.TextBox1.Text, "###-##-####")
End Sub

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Kenny wrote:
Thanks so much, works great!
How can I populate the formatting of the ssn or phone number back to
the textbox, after change?


"Greg Maxey" wrote:

1. Use the Change event with this code:

Me.TextBox1.SetFocus

2. Change UserForm1.Hide to Unload Me

3. Use a CharFormat switch. e.g., { REF "CustomersName"
\*CharFormat } and apply bold formatting to the "R" in "REF"

4. Use the Format Method. e.g., oRng.Text = Format(Me.TextBox3.Text,
"###-##-####")
and oRng.Text = Format(Me.TextBox5.Text, "(###) ###-####")

You might be interested in UserForm data validation. See:

http://gregmaxey.mvps.org/Validate_U..._TextEntry.htm


Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Kenny wrote:
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




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I allow a user to add attachments to a form? Ben1980 Microsoft Word Help 0 June 19th 07 01:31 PM
Inserting checkboxes on a user form RobertPearson via OfficeKB.com New Users 1 June 22nd 06 08:19 PM
User form Mark Microsoft Word Help 1 April 9th 06 05:06 PM
Attempting to disable all user functionality in a form except for form entry [email protected] Microsoft Word Help 1 February 6th 06 03:37 PM
User Form Tasks mully New Users 2 June 1st 05 07:40 PM


All times are GMT +1. The time now is 03:44 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"