Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Oct 2014
    Thanked 0 Times in 0 Posts

    Macro to convert figures in USD to a different currency

    Hi everyone,

    I have a Word document that contains a huge amount of figures in US dollars that I would like to convert to a different currency. I am trying to figure out if it would be possible to write a macro that finds all these numbers and multiplies them by a user-defined constant? I'm somewhat lacking in the VB programming department but does anyone here know if this is even possible? I'm thinking the biggest challenge is to correctly identify each figure, i.e. "123,456.78" should not be identified as three separate numbers etc. Does anyone have any ideas?

    Any help would be greatly appreciated!

  2. #2
    Super Moderator
    Join Date
    May 2002
    Canberra, Australian Capital Territory, Australia
    Thanked 428 Times in 353 Posts
    Doing a currency conversion is a trivial exercise. Amounts containing ',' for a thousands separator and '.' for a decimal separator are understood in VBA as a single number. All you really need to know is how to identify where the amounts are (you probably wouldn't want to convert dates & times, for example) and what the conversion rates are. Indeed, if the data are all in a table and you want to retain the original, the conversion rate and the result, you don't even need VBA - it can all be done with field coding.

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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