PDA

View Full Version : Word table calculations



GetSmart
09-29-2005, 01:18 PM
Have form based on word tables...

:hi: In cell A1 there is a dropdown, with 1, 2, 3, 4. In Cell A2 I want to display a value for each of the numerals in the dropdown when selected. Example: 1=0.25, 2=0.50, etc.

How can I get Cell A2 to correctly display the numeric value? As a test, I tried using a calculation field in A2 as: =IF(A1=1,0.25,"") but am not getting any value pulled up. I would need possibly a nested IF statement if this is the same as the IF, THEN, ELSE. Various iterations of the formula only elicit error messages like, "Unexpected end of message" or error ,"....Am I not taking the right approach?

My thanks:bow:

lucas
09-29-2005, 01:57 PM
I'm not a word person but you can go to insert on the main toolbar and click on object

insert-object .........you will get a dialog box from which you can select Microsoft Excel Spreadsheet. It will run your formula. Not sure if this is a good solution for your problem but its a suggestion.

MOS MASTER
09-29-2005, 02:29 PM
Hi and welcome to VBAX! :hi:

You talk about a a dropdown in your questions..is that one of the Formfields toolbar...

In other words are you making a form out of formfields?

In that way you can use the calculate on exit property of the formfield and address the formfield by its bookmark name.

Coding is possible of course to and you could utilise a exit macro to do your calculating/updating query.

In other words could you give more design details. :whistle:

GetSmart
09-29-2005, 03:48 PM
I develop e-forms using word, creating protected form templates (.dot) Some of the forms are totally locked down (best kind!) and some have sections protected and unprotected (worst kind - mucho trouble).

The forms are built using word tables and form fields. And yes, the dropdown I mentioned is on the Forms Toolbar. The cells in w/tables use absolute cell references (a1, b12, etc), so formulas which I generally use, reference these cell references in the formulas, and if you merge cells, there is still a cell reference which you can ascertain using the TableCellHelper macro (nifty and time saving). Am attaching a document so you can see what I'm doing without the functionality of code to insert the correct number into the cell upon selection from the dropdown.

I.E. user clicks on dropdown, selects one of 4 numbers, 1, 2, 3, 4, upon exit after selection would like appropriate value to "appear" in cell to left of dropdown. This would in turn be totaled at bottom of column. You will not see the result of the dropdown as it is a dingbat font I developed for my company for this task. Let me know if you need additional info....someone might find it of value...my thanks

MOS MASTER
09-30-2005, 04:32 PM
Hi, :hi:

Thanx for the clarification.
I think I know what you mean now but I've never done this with combo's from the forms toolbar.

I know we can do this with code but will have to test it out to make it fields only which would be nicer.

Don't have enough time available now so will revisit the topic later. :whistle:

fumei
09-30-2005, 05:28 PM
1. It is a very good idea to use Option Explicit in your code module!

2. Running this - that is, firing the DOT file to clone a new document - gives me a run-time error. Object not set. Using Option Explicit would help to identify this.

3. Opening the DOT file itself, and protecting it (it it should be protected beforehand!) seems to work OK. Selecting an item from the dropdown puts that number to the left of the dropdown. Could you please describe what is, and what is NOT, happening for you?

GetSmart
10-03-2005, 09:46 AM
Am assuming you took a look at the template I attached....and you are right about the Option Explicit.

The elegant way for this template to work, would be that when the user clicks on the dropdown and selects from one of the 4 numbers, upon exit the recipricol number would be added at the bottom of the column. And any dropdowns selected in the column would add to the total..

The in-elegant manner that it is set....Since I could not figure out how to make that work, I added a column to the left of the dropdown and the user has click on the dropdown as well as type in the percent, which does total at the bottom of the column.

With the code I've got - I can't get the number from the dropdown to appear in the left hand column to add either! Argh! Can't see the forest for the code.

My thanx...for taking a look-see

fumei
10-04-2005, 09:29 PM
when the user clicks on the dropdown and selects from one of the 4 numbers, upon exit the recipricol number would be added at the bottom of the column. And any dropdowns selected in the column would add to the total..

I have no idea what the quote above means.

Again - please describe what is happening for you, and what you want to happen. You must describe precisely. Again, I (once the document is protected for forms) pick a number from the drop down and that number is inserted into the left of the drop down.

Again - what is happening that you do not want to, or NOT happening but you would like to?

You mention "percent" in the last post....but you NEVER have mentioned that you want percent added...nor do you mention if that is simply having the TEXT "%"....or do you want a calculation performed?

I am sorry, but we can't help you unless you actually state, again, EXACTLY, and I really mean exactly, what you want to happen.

For example:


And any dropdowns selected in the column would add to the total

What do you mean "any" dropdown???? There IS only one per column. Any would mean ...well, any. Does that mean ...well, any dropdown is added to the.....Add to WHAT total????? Does it mean any dropdown is added all columns? Say the dropdown (of "any") in column 5 is selected...does that mean the number is added to say column 2??? What does "any dropdown" mean?

GetSmart
10-05-2005, 10:47 AM
:banghead: Please take a look at the pdf file attached.....(a picture is still worth a thousand words). The Word template is attached in an earlier thread. The form template is completely protected. It consists of 5 columns and 5 rows for user entry. Currently, the sixth row at bottom is numerical calculation based on the numbers typed in the fields to the left of the dropdowns. The overall Score in the bottom left cell is an average of all the totals in the "Total Row".

The circles or "pie pieces" are a "dingbat" font I created and are represented by the numbers in the dropdown. 1=empty, 2=1/4 or .25, 3=1/2 or .50, 4=3/4 or .75 and 5=solid or 1.00. This is it in a nutshell.

Currently, the user has to "type in the number", (i.e., 0.00, 0.25 etc.), then also has to click on the dropdown to show a "picture" that corresponds to the number typed in. I want to do away with the user having to type in the number. I want the "total" to calculate based on the corresponding value that is selected thru the dropdown.

:dunno Can you hear me now????

fumei
10-06-2005, 06:31 AM
Well this looks quite a bit different than the the previous file you posted, doesn't it? Let me take a good look. Although I am going to finally have to download Acrobat Reader to really see it, as the PDF opens in Photoshop for me. I never use PDF. I will get back to this.