Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display variable in WORD with specified decimals 1

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
Is it possible to specify the decimals of a variable defined in a macro as single ?

More specific:
I want a variable called "coordinate" with a value of 0.0200334543195 to be diplayed in WORD as 0.0200 using the code Selection.TypeText Text:=coordinate
 
Given your suggested code, it seems you don't want the variable actually saved in the document so all you have to do is manipulate the variable in VBA, using, say, [blue][tt]Format[/tt][/blue], for example:

Code:
[blue]Selection.TypeText Text:=Format(coordinate, ".0000")[/blue]

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Thanks for your quick response !
This is what I was looking for.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top