Word 2003 calculate GPA

G

gary92fxr

Hello,
I created a report card template awhile ago with drop down fields for
teachers to input student grades (A, B, C, etc.) I was asked recently if it
were possible to calculate the GPA from these field results. I'm over my head
here. What is the best approach? Macro? Visual Basic? Active X? Has anyone
out there generated this code?
Thanks,
Gary
 
B

Bear

Gary:

I'm sure it can be done with a macro, but if your grades are in a table it
may be possible to use some kind of equation. I don't know how one determines
a GPA from a series of letter grades.

Bear
 
E

Edward Thrashcort

Is it the calculation, or the programming method you are interested in?

It looks as if the calculation method is described here
http://www.back2college.com/gpa.htm

Programmatically, you would do this with VBA, assuming all the relevant data
is available in the form fields of your document.

You would iterate through the ActiveDocument.FormFields collection to
extract their data into an array and then process the array

If I remember correctly, you have to assign the current ".result" to the
".TextInput.Default" to avoid losing the data. It's such a long time since
I did this sort of stuff, I don't remember fully why I did that!

Eddie
 
B

Bear

Gary:

Okay. You can use VBA this way. Start by adding a bookmark or text formfield
to your document to hold the GPA. If you use a text formfield, you can leave
it enabled or disable it (via the Fill-In Enabled check box).

Iterate through the formfield collection

For each formfield that matches your criteria for holding a grade (name or
value?)
Convert the grade to points and add them to a running total
Add the corresponding course hours to a running total

At the end of the iteration do the division, format that result however you
want it displayed (re number of zeros, decimals, etc.)

Put the formatted result into the bookmark or text formfield.

You could add a custom command to the Tools menu (being sure to store this
customization in the same template as your code, which should be the same
template that creates your form) to run the macro. Or you could put a macro
button right on the form beside the GPA text formfield.

Bear
 
G

gary92fxr

Bear, Thank you. Will do.
-Gary

Bear said:
Gary:

Okay. You can use VBA this way. Start by adding a bookmark or text formfield
to your document to hold the GPA. If you use a text formfield, you can leave
it enabled or disable it (via the Fill-In Enabled check box).

Iterate through the formfield collection

For each formfield that matches your criteria for holding a grade (name or
value?)
Convert the grade to points and add them to a running total
Add the corresponding course hours to a running total

At the end of the iteration do the division, format that result however you
want it displayed (re number of zeros, decimals, etc.)

Put the formatted result into the bookmark or text formfield.

You could add a custom command to the Tools menu (being sure to store this
customization in the same template as your code, which should be the same
template that creates your form) to run the macro. Or you could put a macro
button right on the form beside the GPA text formfield.

Bear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top