+ Reply to Thread
Results 1 to 18 of 18

losing zeros following decimal point

  1. #1
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    losing zeros following decimal point

    I am sending data from an excel sheet to a word template (Office 2007). In the excel sheet, 2 of the fields are formatted as Euro currency with 2 decimal points and show as €111.00. When they copy to the word document they are reduced to €111 and the 2 zeros are missing. I can’t change the template to [bookmark].00 because sometimes there is numbers after the decimal point, ie, €111.69.

    Any advice please.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    does "Intersect(thisrow, Header.EntireColumn)" represent the euro value?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    I believe that this part selects the contents from all of the [] bookmarks. Two of those are shown here.
    sample of sheet.jpg

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    OK I have an idea... But what is the text inside the [ ] in the word template? Where the euro value is posted.

  5. #5
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    Both text inside are as in the header titles, as in the before and after images here.
    Template Before filling
    before.jpg
    Tempate after filling
    After.jpg

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    So I figured best way is to check the word template, and if to the left of the [ there is a € then format with 2 decimals, otherwise paste as normal.

    replace this line:
    Please Login or Register  to view this content.
    with these:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    Thank you Arkadi, you are a star. It works as I wanted now. Thanks again.

    Am I right to presume, if there i no € before the [, then the new line would be
    Please Login or Register  to view this content.
    ? I'm trying to understand and not keep bothering people.

    Also, if you don't mind me asking, I have put this at the top of the template C:\Users\Me\Enquiries\[Enq_Id]-[First_Name]-[last_Name].doc , So that I cut and paste it to save the file. Can I add something in the code, to make this automatic?

    Thank you for your help.

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    MallorcaPete, my code as provided checks for euro symbol, and the second part (else...) Takes care of when there is no euro symbol. You don't need extra code. Does that make sense? If not, then I can explain better, but you don't need to add anything. Estoy a punto de irme al trabajo, te contesto la segunda pregunta en cuanto llegue.

  9. #9
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    Thank you Arkadi, Yes, it makes sense, so I could use this whenever there is a € before the value, great.

    I will look forward to your reply for the second part, although my Spanish is not very good, I have not been her very long. It's more like Spanglish at the moment.

  10. #10
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    Hi pete, sorry about the spanish. I just assumed with the name and being in Spain... my bad.
    To elaborate on the earlier reply, my little piece of code is like this:

    Please Login or Register  to view this content.

  11. #11
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    As I think about your second question, I am not sure I fully understand.... you have put that text at the top of the template... but you would like to make the saving of the word document automatic with that file name, I assume in the Excel macro code? I assume Enq_ID, First_Name, and last_name are headers in your excel sheet?

  12. #12
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    Yes Arkadi, That text is the first line of the template. It has bookmarks [] that are populated by the excel sheet headers and works perfect.

    When the template opens, I select that text and "cut" it, I then select "Save as" and paste tat text into the save file name box.

    If the macro can do this, I would be able to simply check the documet is ok and then close it.

    Thanks for taking your time to help.

  13. #13
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    Try this version then:

    Please Login or Register  to view this content.
    EDIT!! Your template no longer needs "C:\Users\Me\Enquiries\[Enq_Id]-[First_Name]-[last_Name].doc" at the top, the code does not cut/paste, it just uses that format from inside the macro itself.
    Last edited by Arkadi; 05-21-2015 at 10:10 AM.

  14. #14
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    Thank you so much Arkadi, That is exactly what I wanted it to do. I added an ' in front of "wD.Close 0" and "wA.Quit" and it's perfect, I have left them in place, for future reference. Thanks again Arkadi.

  15. #15
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    You are very welcome
    Please mark the tread as solved if you are satisfied?

  16. #16
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    Marked as solved, but couldn't find "Mark as solved, quickly and very profesionaly" . Thanks Arkadi

  17. #17
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: losing zeros following decimal point

    Thanks Pete, very kind words. That's what the "Add Reputation" button is for I guess

  18. #18
    Registered User
    Join Date
    04-14-2015
    Location
    Spain
    MS-Off Ver
    office 2007
    Posts
    42

    Re: losing zeros following decimal point

    Found it

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Removing Leading Zeros, maintaining zeros after decimal
    By Waycool86 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-17-2015, 01:15 PM
  2. VBA - losing a decimal point in equation
    By stegngas in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2014, 12:19 PM
  3. [SOLVED] count of numbers after decimal point with trailing zeros
    By lasario in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2013, 11:13 AM
  4. Replies: 1
    Last Post: 01-27-2013, 08:06 PM
  5. Replies: 3
    Last Post: 03-18-2006, 02:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1