Automatic Summation

A

Anvah Gareson

Hi,

I am creating an assignment sheet in word. At the end of each question
there's the mark allocation.

Ex:

What is the capital of Canada? (3 marks)

I would like to create a macro that will find all the marks and sum it
together, and add the total at the end of the document. What is the
best approach for this? I'm an experienced developer, but have no
experience with VBA. So, any guidance will help.

Thank you in advance!
 
C

Cindy M.

Hi Anvah,
I am creating an assignment sheet in word. At the end of each question
there's the mark allocation.

Ex:

What is the capital of Canada? (3 marks)

I would like to create a macro that will find all the marks and sum it
together, and add the total at the end of the document. What is the
best approach for this? I'm an experienced developer, but have no
experience with VBA. So, any guidance will help.
The first thing you have to decide is: how will the code identify the
values to be summed. If you don't want to do anything else than what you
show us, then you'd probably have to base your solution on Edit/Find.

Using bookmarks would be simpler, especially if you could bookmark each
value in the text.

Personally, I'd be inclined to set the entire thing up in a table, with
the value in one column. Then I could sum the column (or loop through the
cells in that column).

You know best how you're going to set up the document and use it. What
seems the most likely/logical approach to identify the information to
you? And which version of Word are we discussing?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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