Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I allow a user to add attachments to a form? | Microsoft Word Help | |||
Inserting checkboxes on a user form | New Users | |||
User form | Microsoft Word Help | |||
Attempting to disable all user functionality in a form except for form entry | Microsoft Word Help | |||
User Form Tasks | New Users |