Currency sign and formulas

M

Marco

Hello all

I use a table in a document to create an invoice
When I fill in ammount (A2) and price (B2) the formula gives te total (C2, with fielcodes for notation/format)
But I want the currency sign automaticaly placed before the price (B2) I give in

How can I change the format of a cell (with no formula in it), so when I type in for example 12, the value of the cell is $ 12,00

Any suggestions

Thanks in advance.
 
G

Graham Mayor

Probably the simplest plan would be to make this invoice into a form and use
form fields for the variable data - you can format the appropriate fields
as numbers with currency masks. The calculations you can do outside the form
fields using an = field with a currency mask. Make sure that you set the
last form field's properties to calculate on exit so that the calculation
will be updated.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP

Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
M

Marco

Hi Graham

First of all, thanks for your reply

If have two small questions
* Can you tell me how to format the fields as you mentioned? How do I make from a cell a form field

* How can I set the last form field's properties to calculate on exit

Thanks in advance
Marco.
 
D

Doug Robbins - Word MVP

See:

Please Fill Out This Form
Part 1: Create professional looking forms in Word
http://www.computorcompanion.com/LPMArticle.asp?ID=22

Part 2: Adding Automation to your Word forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=46

Part 3: Learn more VBA (macros) to automate your forms.
http://www.computorcompanion.com/LPMArticle.asp?ID=119

Part 4: Use custom dialog boxes in your Word forms
http://www.computorcompanion.com/LPMArticle.asp?ID=127

Part 5: Connect your AutoForm to a database to save input time and keep
better records!
http://www.computorcompanion.com/LPMArticle.asp?ID=136


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
M

macropod

Hi Marco,

You need to add a currency picture switch to your calculation field, like:
\# $,0.00
To do this, select the field and press Shift-F9, then add the switch to the
end of the field and press F9 again to update the result.

Cheers
 
G

Greg

Marco,

Here is a scad of information on creating Word forms. See
the linked articles by Dian Chapman.

http://word.mvps.org/faqs/tblsfldsfms/LinesInForms.htm

Basically you just need to display the forms tool bar,
with the toolbar insert a form field in cell A2 and B2.
Double click each formfield and apply the currency masks
and check calculate on exit.



-----Original Message-----
Hi Graham,

First of all, thanks for your reply.

If have two small questions:
* Can you tell me how to format the fields as you
mentioned? How do I make from a cell a form field?
 
M

Marco

First of all thanks all for the reply

I'm almost there... I created the form with the pre-defined fields. I also use the option calculate on exit
But before I enter my information in the table, a macro is entering information in the top of the document. But when I secure the form already in the .DOT file the macro gives an error because of the protected form. Is there an option to add a vba line after everything is filled in, to protect the form

So my last lines are

Unload frmInvoiceDataEntr
ActiveDocument.Sav
End Su

But before the End Sub I would like to protect the form so the user can only fill in those fields I defined in the form

Thanks again everybody
Marco
 
G

Greg

Marco,

Try before the ActiveDocument.Save:

On Error GoTo Ignore
ActiveDocument.Protect Type:=wdAllowOnlyFormFields,
NoReset:=True
MsgBox "The form is now protected."
Ignore: Err.Clear

You might need to put a ActiveDocument.Unprotect line in
somewhere in your code.

HTH

-----Original Message-----
First of all thanks all for the reply.

I'm almost there... I created the form with the pre-
defined fields. I also use the option calculate on exit.
But before I enter my information in the table, a macro
is entering information in the top of the document. But
when I secure the form already in the .DOT file the macro
gives an error because of the protected form. Is there an
option to add a vba line after everything is filled in, to
protect the form?
So my last lines are:

Unload frmInvoiceDataEntry
ActiveDocument.Save
End Sub

But before the End Sub I would like to protect the form
so the user can only fill in those fields I defined in the
form.
 
G

Graham Mayor

Not having see the rest of your macro, can I suggest that you run all the
autonew macro code on an unlocked form template to insert whatever it was
you were inserting at the top of the document then add the line

ActiveDocument.Protect Type:=wdAllowOnlyFormFields

To lock the form and provide access to only the fields. The above has the
effect of clicking the padlock icon on the forms toolbar.

Given that you have thrown in this extra requirement into the pot, I might
have been tempted to suggest that you employ a userform to gather all your
data run your bit of code and enter the data and calculations in the
required parts of the document. This is a bit more elegant than an on-line
form. There is loads of information about userforms on the MVPS web site -
see link in sig block.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP

Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
M

Marco

Thank you very much, all of you

With your help I solved my problem

Thanks again
Marco.
 

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