Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-25-2018, 04:03 PM
tiathetechwriter tiathetechwriter is offline I am not a VBScript person Windows 10 I am not a VBScript person Office 2016
Novice
I am not a VBScript person
 
Join Date: Jun 2018
Posts: 3
tiathetechwriter is on a distinguished road
Default I am not a VBScript person

I have never done any VBScript before, never needed to. But I kinda do now.

I have a word document 2016 with 6 drop-down menu content controls, title/labels A, B, C, D, E, F.
Each drop down contains these options, values:
Poor, 1


Fair, 2
Satisfactory, 3
Good, 4
Excellent, 5

Each field is neutral when loading, "Please select a value"

I have a field at bottom I want to have average the values from the 6 dropdowns as they are visited:
((valueA + valueB + valueC +valueD +valueE +valueF)/(number visited))

This is better as a variable:
((totalScore)/(numVisited))

entryValue: [userselected];
global: totalScore: 0;
global: numVisited:0;

After a user selects an option, I want the field to evaluate the selection, use its numerical value to update the totalScore and numVisited variables used for the average, and display the average.

onExit
{If (entryValue= "Poor") {
entryValue+=1;
} else if (entryValue = "Fair") {
entryValue+=2;
} else if (entryValue = "Satisfactory") {
entryValue+=3;
} else if (entryValue = "Good") {
entryValue+=4;
} else {
entryValue+=5;
}
numVisited+=1;
totalScore+=entryValue;
}

I don't know vb, though, and I need some help writing the code for this, and I need to know what field type to use for the average field.

Thank you in advance!

-TiaTheTechWriter
Reply With Quote
  #2  
Old 06-25-2018, 09:41 PM
Guessed's Avatar
Guessed Guessed is offline I am not a VBScript person Windows 10 I am not a VBScript person Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Can you load a sample document with the necessary CCs? Where does number visited come from? Is it the number out of the a-f fields that have been completed?

And you are after VBA not VBScript - there is subtle differences.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 06-25-2018, 10:42 PM
gmayor's Avatar
gmayor gmayor is offline I am not a VBScript person Windows 10 I am not a VBScript person Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The attached should give you a few ideas
Attached Files
File Type: docm Choose an Item.docm (50.4 KB, 14 views)
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #4  
Old 06-28-2018, 12:46 PM
tiathetechwriter tiathetechwriter is offline I am not a VBScript person Windows 10 I am not a VBScript person Office 2016
Novice
I am not a VBScript person
 
Join Date: Jun 2018
Posts: 3
tiathetechwriter is on a distinguished road
Unhappy

Quote:
Originally Posted by Guessed View Post
Can you load a sample document with the necessary CCs? Where does number visited come from? Is it the number out of the a-f fields that have been completed?

And you are after VBA not VBScript - there is subtle differences.
I'm after whatever will get the job done the quickest and cleanest with the least maintenance. I've attached the file. While I'm using tables to keep formatting even, I'm not using one big table, so using the cells to do the calculations using bookmarks doesn't seem to work this way. I don't really want to put the document in one big table, either, because I don't want to deal with table breaking across pages. This is an update to an older, clunkier document built as tables, and I'm trying to get away from that as much as possible.

I considered doing it as a sharepoint page, but there are other concerns there.
Attached Files
File Type: docm Employee_performance_review.docm (37.7 KB, 11 views)
Reply With Quote
  #5  
Old 06-28-2018, 03:57 PM
tiathetechwriter tiathetechwriter is offline I am not a VBScript person Windows 10 I am not a VBScript person Office 2016
Novice
I am not a VBScript person
 
Join Date: Jun 2018
Posts: 3
tiathetechwriter is on a distinguished road
Default

I actually ended up creating it in InfoPath and publishing it to a network share with email submission. Turned out pretty nifty there, if I do say so myself! Thanks, all!
Reply With Quote
Reply

Tags
average, dropdowns, vb

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2010 VBScript - error: forward a custom form Berg Outlook 0 08-31-2015 10:10 AM
I am not a VBScript person VBScript - outlook does not recognize one or more recipients johnc83 Outlook 1 07-16-2015 06:42 AM
I am not a VBScript person VBScript.RegExp: exclude a particular word tinfanide Excel Programming 2 06-07-2012 06:52 AM
.doc Suddenly Changed to .vbe (VBScript Encoded Script File) emes Word 2 04-24-2012 05:07 PM
VbScript to Print a .pdf DaveB Excel 2 03-07-2009 12:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:14 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