Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Word 2003 calculate GPA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gary92fxr - 19 Jun 2007 19:57 GMT
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
Edward Thrashcort - 19 Jun 2007 21:46 GMT
So you decided to go over our heads with terms like "GPA"?

Eddie

> *From:* gary92fxr<gary92fxr@discussions.microsoft.com>
> *Date:* Tue, 19 Jun 2007 11:57:04 -0700
[quoted text clipped - 7 lines]
> Thanks,
> Gary
gary92fxr - 20 Jun 2007 05:35 GMT
Sorry Eddie.
GPA = grade point average
-Gary

> So you decided to go over our heads with terms like "GPA"?
>
[quoted text clipped - 11 lines]
> > Thanks,
> > Gary
Edward Thrashcort - 20 Jun 2007 10:30 GMT
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

> *From:* gary92fxr<gary92fxr@discussions.microsoft.com>
> *Date:* Tue, 19 Jun 2007 21:35:02 -0700
[quoted text clipped - 18 lines]
> > > Thanks,
> > > Gary
Bear - 20 Jun 2007 14:33 GMT
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

Signature

Windows XP, Word 2000

> Is it the calculation, or the programming method you are interested in?
>
[quoted text clipped - 35 lines]
> > > > Thanks,
> > > > Gary
gary92fxr - 20 Jun 2007 22:18 GMT
Bear, Thank you. Will do.
-Gary

> Gary:
>
[quoted text clipped - 60 lines]
> > > > > Thanks,
> > > > > Gary
gary92fxr - 20 Jun 2007 22:19 GMT
Thanks much for the advice. I'll go with VBA for the GPA. FYI
-Gary

> Is it the calculation, or the programming method you are interested in?
>
[quoted text clipped - 35 lines]
> > > > Thanks,
> > > > Gary
Bear - 19 Jun 2007 21:56 GMT
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

Signature

Windows XP, Word 2000

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.