Help needed for macro to calculate

L

lois

Hello friends,
I have before drawn from your knowledge, and hope that you can, and
will assist me again.

I have composed 2 form both with 5 columns each. My need is for 2
macros that would calculate the total, print a copy and reset or clear
fields and columns for next use. Each form is individual.

Form 1: Item No., Description, Rate, Rental-Period,Amount . with
possibility for a 5%,10%, and 15% discount on the Total to the
customer.

Example: Item 01 Descr. Wheelchair Rate $9 Rental Period 14dys.
Amount $126,-
5%Dis. $6.30 Total $119.70

Form 2 columns are: No., Service, Rate, Days, Amount.
Example: 102 Service. Brush cutting Rate. $40 Days. 2 Amount. $80
Total. $80


I'm sure someone will come to my rescue.
Thanks
 
G

Greg

You obviously charge for your services. Would you
consider paying for mine?

Are these protected forms using formfields?
A first glance you need a sixth column:

Item Description Rate Period Discount Item Total

Using number type text fields for Rate and Period and a
dropdown field for Discount assign the bookmark variables
variables x, y and z repectively. The formula for Item
Total would be

{=(({x}*{y})-({z}*({x}*{y})/100))}

Your could then use a {=sum(above)} in a total field.

This could work as a print clear macro:


Sub PrintAndClear()

With ActiveDocument
.PrintOut
.Unprotect
.Protect Type:=wdAllowOnlyFormFields, NoReset:=False
End With

End Sub
 
L

lois

Hi Greg,
Thanks a million for your prompt response, and also the little
"smartie" regarding payment. Because you've been so fast with a code
for me, I certainly can offer to buy you a beer or a cold drink if I
should pass by your domain one fine day.

Anyway, Yes the form is protected. Is that good or bad for the macro ?
Oh !, and I forgot to state that these are in Word 2000. Hope that it
does not change anything. I will await any reply you may have for me,
and I do appreciate you promptness and humor.

Lois
 
G

Greg Maxey

Lois,

A cold beer will be fine. The fact you are using Word2000 doesn't matter.
I worked out the formula using Word2000.

You could run the macro with a command button. See:

http://word.mvps.org/FAQs/TblsFldsFms/HidePrintButton.htm

This code will hide the command button, print the document, display the
command button again, and reset fields.

Private Sub CommandButton1_Click()

With ActiveDocument
.Shapes(1).Visible = msoFalse
.PrintOut Background:=False
.Shapes(1).Visible = msoTrue
.ResetFormFields
End With

End Sub

You should have all you need to finish your two forms. Good luck.
 

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