Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2016, 08:45 AM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default Output based on Combo Box selected items in Microsoft Word

Dear All Colleagues,



I need help about Word VBA. I have word document and need to add combo boxes containing five list items i.e. Excellent, Very Good, Good, Below Average, Poor. When I select the list item the following output is desired:

Excellent; 1 ( Font color Green)
Very Good; 2 (Color Green)
Good; 3 (Color Orange)
Below Average; 4 (Color Red)
Poor; 5 (Color Red)

I need this corresponding word on the same page when selected any item in combo box. Here is the screenshot of the same:

http://prntscr.com/9wtr5s

There are 11 sections which will contain same combo boxes and their output will be screened on summary page. The view of the summary page is as follows:

http://prntscr.com/9wtlfr

Score achieved will be added on summary sheet after selecting combo box item of each section page. I hope you understand this requirements.

Please help
Reply With Quote
  #2  
Old 01-30-2016, 07:03 PM
gmaxey gmaxey is offline Output based on Combo Box selected items in Microsoft Word Windows 7 32bit Output based on Combo Box selected items in Microsoft Word Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

First of all why would you want a combobox, if your choices are fixed as described? Seems you would want a dropdown list.

I would use a dropdown list content control and then use the ContentControl_OnExit event in the ThisDocument module to evaluate the selection made and populate the data to other places. You state you need "help." What have you done for yourself?

Here is a start:

Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
  Select Case ContentControl.Title
    Case Is = "Section 1 Score"
      'Write some text here
      'Write this score there
    Case Is = "Section 2 Score"
      'etc.
  End Select
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 01-30-2016, 11:34 PM
macropod's Avatar
macropod macropod is offline Output based on Combo Box selected items in Microsoft Word Windows 7 64bit Output based on Combo Box selected items in Microsoft Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

fairchance: did you bother doing a search? This kind of problem has been addressed numerous times before...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 01-30-2016, 11:40 PM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default

Thank you sir for reply Sir. Here is my file please make this code here:

https://www.dropbox.com/s/0joqy9pr4s...late.docx?dl=0

Moreover, i have select combo box as the reader will read each section and put his remarks as Excellent etc. That will converted into numeric scores. I have give some detail on page no. 16-17. If you have another idea for this kindly share with me.

Kind Regards
Reply With Quote
  #5  
Old 01-31-2016, 01:44 AM
macropod's Avatar
macropod macropod is offline Output based on Combo Box selected items in Microsoft Word Windows 7 64bit Output based on Combo Box selected items in Microsoft Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by fairchance View Post
Here is my file please make this code here:
fairchance: This forum is not a free coding service. When I look at your posting history, one thing is clear: you expect others to do all the work for you. That is not fair!!! We are more than willing to help when you get into difficulty, but you should also invest some effort of your own.

As I said in my previous reply, a search of the forum will reveal numerous solutions for tasks such as yours. Make use of them.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 01-31-2016, 02:31 AM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default Output based on Combo Box selected items in Microsoft Word

Sir,

Can you please refer the to the previous post link which is more close to my my post.

Regards
Reply With Quote
  #7  
Old 01-31-2016, 10:50 AM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default Output based on Combo Box selected items in Microsoft Word

Sir, I am waiting for your reply. Please guide me as early as possible.
Reply With Quote
  #8  
Old 01-31-2016, 03:35 PM
macropod's Avatar
macropod macropod is offline Output based on Combo Box selected items in Microsoft Word Windows 7 64bit Output based on Combo Box selected items in Microsoft Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

As I have already said, this forum is not a free coding service. Furthermore, a simple search of these forums will return examples of documents coded to do essentially what you are asking for. See, for example: https://www.msofficeforums.com/word-...selection.html

I do not see from your posts to date or from your attachment that you have made any effort to implement the code examples that are already available. When you're ready to give evidence that you have at least tried to do something meaningful and you need help with a particular aspect of the code, post back with your code and the specific details of what aspects of it you need help with.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 02-03-2016, 08:09 AM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default

Dear Sir,

Hi

I have done my work and color change is not my requirements now. My template is fine for Microsoft Office for Windows version. I need to convert this template for Microsoft Office 2006 for Mac as I have no idea about it. I hope you will definitely help me. Here is my file.

https://www.dropbox.com/s/ns4wnwn24q...2%29.docm?dl=0

Kind Regards

Fairchance
Reply With Quote
  #10  
Old 02-03-2016, 02:28 PM
macropod's Avatar
macropod macropod is offline Output based on Combo Box selected items in Microsoft Word Windows 7 64bit Output based on Combo Box selected items in Microsoft Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by fairchance View Post
My template is fine for Microsoft Office for Windows version. I need to convert this template for Microsoft Office 2006 for Mac as I have no idea about it.
There is no such thing as Microsoft Office 2006 for Mac. Microsoft Office for Mac exists as versions 2004, 2008, 2011 and 2016 (aka Office 365).

Regardless of which Mac version you mean, you will have to completely redo your form and its VBA code as Content Controls do not work on Mac versions 2004, 2008 & 2011 (Active-X controls do not work on any Mac version). You will need to use formfields instead. Do note, too, that Word 2008 does not support macros.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 02-03-2016, 07:36 PM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default

Yes Sir, you are right it is Microsoft Office 2016 for Mac. Secondly, Can you give me some initial start with Form Field Drop Down coding. Simply, If i place this field on word file in Windows Version of this office then drop down box is not working.

Thank you for guidance.
Reply With Quote
  #12  
Old 02-03-2016, 07:59 PM
macropod's Avatar
macropod macropod is offline Output based on Combo Box selected items in Microsoft Word Windows 7 64bit Output based on Combo Box selected items in Microsoft Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For dropdown formfields, you could employ a macro like:
Code:
Sub ColorDropDown()
Dim sText As String, oFld As FormField
Const Pwd As String = ""
With ActiveDocument
  Set oFld = Selection.FormFields(1)
  sText = oFld.Result
  If .ProtectionType <> wdNoProtection Then .Unprotect Password:=Pwd
  With oFld.Range
    Select Case sText
      Case Is = "Bad"
        .Font.Color = wdColorRed
      Case Is = "Poor"
        .Font.Color = wdColorOrange
      Case Is = "Fair"
        .Font.Color = wdColorYellow
      Case Is = "Good"
        .Font.Color = wdColorGreen
      Case Is = "Excellent"
        .Font.Color = wdColorBlue
      Case Is = "Outstanging"
        .Font.Color = wdColorIndigo
      Case Else
        .Font.Color = wdColorBlack
    End Select
  End With
  .Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=Pwd
End With
End Sub
For any formfield you want to use this code with, simply designate 'ColorDropDown' as the formfield's on-exit macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 02-04-2016, 08:41 PM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default

Thank You Sir for guidance. Actually, the color change on selection of particular drop down item is not required now as I have told you earlier. I need the score change with drop down selection item.

I have tried to implement legacy form control in my template but the score is not being change on selecting the drop down item. Kindly guide me about the following:

1. Whether the below template will be workable on Mac Machine?
2. How the score will be change after changing of every drop down item.

https://www.dropbox.com/s/f0y0xh8dtg..._Mac.docm?dl=0

Kind Regards

Shehbaz H.
Reply With Quote
  #14  
Old 02-04-2016, 09:35 PM
macropod's Avatar
macropod macropod is offline Output based on Combo Box selected items in Microsoft Word Windows 7 64bit Output based on Combo Box selected items in Microsoft Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by fairchance View Post
Actually, the color change on selection of particular drop down item is not required now as I have told you earlier. I need the score change with drop down selection item.
That's all very well, but you did not say you wanted to convert the selection to a score instead. All you said was:
Quote:
I have done my work and color change is not my requirements now.
without actually saying what your requirements were.
Quote:
Originally Posted by fairchance View Post
Kindly guide me about the following:

1. Whether the below template will be workable on Mac Machine?
2. How the score will be change after changing of every drop down item.
If all you're doing is calculating a score from the dropdown selection(s), you don't even need a macro. All you need is some field coding, which will work equally well on both Macs and PCs. See, for example:
https://www.msofficeforums.com/word/...html#post30197
https://www.msofficeforums.com/word/...html#post88302
https://www.msofficeforums.com/word/...html#post74823
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 02-05-2016, 09:25 PM
fairchance fairchance is offline Output based on Combo Box selected items in Microsoft Word Windows 8 Output based on Combo Box selected items in Microsoft Word Office 2010 64bit
Advanced Beginner
Output based on Combo Box selected items in Microsoft Word
 
Join Date: Jun 2015
Posts: 54
fairchance can only hope to improve
Default output-based-combo-box-selected-items-microsoft

Dear Sir,

Thank you so much for guidance. I have implemented your logic and seeking your little advise. The field codes are updating when selecting next action dropdown otherwise these are not updating even if I click other part of document. Please check and rectify.

Thank You

Regards

https://www.dropbox.com/s/wgn78647ou...2%29.docm?dl=0
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Output based on Combo Box selected items in Microsoft Word Moving Selected Items from a Multiselect Listbox on a userform to a bookmark in Word marksm33 Word VBA 3 01-15-2015 07:55 PM
Output based on Combo Box selected items in Microsoft Word Need help creating a Word document that is populated based on certain selected values alidaanish Word 1 01-10-2014 10:44 PM
Output based on Combo Box selected items in Microsoft Word Combo Box Items BoringDavid Word VBA 12 12-12-2013 05:14 AM
Display paragraph of text based on value selected in combo WordWaza Word 0 08-09-2013 06:30 AM
Bold list items in a combo box DrewB Word VBA 0 07-17-2009 11:32 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:08 PM.


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