Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2016, 01:55 AM
highrise955 highrise955 is offline Newbie Question - Need direction on how to proceed Windows 10 Newbie Question - Need direction on how to proceed Office 2013
Advanced Beginner
Newbie Question - Need direction on how to proceed
 
Join Date: Mar 2016
Posts: 37
highrise955 is on a distinguished road
Default Newbie Question - Need direction on how to proceed

Hello all,



I have created a form in Word 2013 that will be used by six different people. At the bottom of the form I created two fields:

  • Name (The Users Name) <Dropdown List>
  • Title (The Users Title) <Dropdown List>
What I want to happen is that when the user selects their "Name" in the Name Field the Title Field will automatically populate their title. Preferably, I would like their name to get populated automatically when they open the form and therefore the Title Field will display the appropriate title as well.



I'm not asking anyone to give me the code but I just want someone to point me in the right direction on how to accomplish this. I installed Greg Maxey's Content Control Tools and CC/V/BM & DP Tools Add-ins. But being a newbie I am still somewhat confused on how to proceed.


- - -


Any help would be greatly appreciated. (Even if that includes posting a link to a previous similar question already asked in this forum.)
Reply With Quote
  #2  
Old 03-03-2016, 02:59 AM
highrise955 highrise955 is offline Newbie Question - Need direction on how to proceed Windows 10 Newbie Question - Need direction on how to proceed Office 2013
Advanced Beginner
Newbie Question - Need direction on how to proceed
 
Join Date: Mar 2016
Posts: 37
highrise955 is on a distinguished road
Default

OK, after searching the forum again I think I may have answered the question myself. This code supplied by macropod seems to do the trick...

Quote:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim i As Long, StrDetails As String
With ContentControl
If .Title = "Name" Then
For i = 1 To .DropdownListEntries.Count
If .DropdownListEntries(i).Text = .Range.Text Then
StrDetails = Replace(.DropdownListEntries(i).Value, "|", Chr(11))
Exit For
End If
Next
ActiveDocument.SelectContentControlsByTitle("Title ").Item(1).Range.Text = StrDetails
End If
End With
End Sub
Thanks macropod!!!

To finish this off can someone point me in the right direction to have the Name field auto-populate upon opening the document? I think this is a "built-in variable" but I don't know how to access it and populate it in the Name field. Also, by auto-populating the Name field can I also auto-populate the Title and if so, how?
Reply With Quote
  #3  
Old 03-03-2016, 05:27 AM
gmaxey gmaxey is offline Newbie Question - Need direction on how to proceed Windows 7 32bit Newbie Question - Need direction on how to proceed Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub Document_Open()
Dim oCC As ContentControl
  Set oCC = ActiveDocument.SelectContentControlsByTitle("Name").Item(1)
  oCC.Type = wdContentControlText
  oCC.Range.Text = Application.UserName
  oCC.Type = wdContentControlDropdownList
  Document_ContentControlOnExit oCC, False
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #4  
Old 03-03-2016, 06:15 AM
highrise955 highrise955 is offline Newbie Question - Need direction on how to proceed Windows 10 Newbie Question - Need direction on how to proceed Office 2013
Advanced Beginner
Newbie Question - Need direction on how to proceed
 
Join Date: Mar 2016
Posts: 37
highrise955 is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
Code:
Sub Document_Open()
Dim oCC As ContentControl
  Set oCC = ActiveDocument.SelectContentControlsByTitle("Name").Item(1)
  oCC.Type = wdContentControlText
  oCC.Range.Text = Application.UserName
  oCC.Type = wdContentControlDropdownList
  Document_ContentControlOnExit oCC, False
lbl_Exit:
  Exit Sub
End Sub

Thanks Greg!

Should this code (along with the other code I showed in the 2nd message of this thread) also update my "Title" control. I'm assuming it should because of the Document_ContentControlOnExit statement. Is this correct?

Also, one last thing (hopefully). Once I have the template the way I want it. What do I need to do to get it to work on our companies server? Besides copying the template to an accessible drive, are there any other parts (xml,docm...) that I need to move over with the template?


Again, thanks again. I really appreciate your assistance.
Reply With Quote
  #5  
Old 03-03-2016, 12:34 PM
gmaxey gmaxey is offline Newbie Question - Need direction on how to proceed Windows 7 32bit Newbie Question - Need direction on how to proceed Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

It should.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #6  
Old 03-03-2016, 04:08 PM
highrise955 highrise955 is offline Newbie Question - Need direction on how to proceed Windows 10 Newbie Question - Need direction on how to proceed Office 2013
Advanced Beginner
Newbie Question - Need direction on how to proceed
 
Join Date: Mar 2016
Posts: 37
highrise955 is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
It should.

...and it did.

Thanks a lot Greg. I really appreciate your help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie question on Word 2010 sunalta Word 7 09-06-2012 12:49 PM
Newbie Question - Need direction on how to proceed Newbie Question thistlebarrow PowerPoint 4 04-06-2012 01:46 PM
Newbie Question - Need direction on how to proceed newbie question DanSandbergUCONN Word 5 03-06-2011 04:27 PM
Newbie Question - Need direction on how to proceed Newbie to Powerpoint question Phil66 PowerPoint 9 06-01-2010 10:51 AM
Perhaps a newbie question I know but as1947 Excel 0 02-05-2009 08:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft