• Word Automation (2000)

    Author
    Topic
    #421938

    I am doing a project where I am sending data to Word via Bookmarks.

    For the price of the item:

    .ActiveDocument.Bookmarks(“ATMPrice”).Select
    .Selection.Text = (CStr(Forms!frmDataEntryATMPurchaseSetup!ATMPrice))

    When I send the data to Word it is sending it as unformatted text. How can I make it show with a comma & 2 decimal places (5,583.00) as an example if the price does not have any cents. In Access the field has a data type of ‘Currency’.

    Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #960559

      Try this:

      .ActiveDocument.Bookmarks(“ATMPrice”).Range.Text = Format(Forms!frmDataEntryATMPurchaseSetup!ATMPrice, “#,##0.00”)

      Note that it is not necessary to select the bookmark. Code generally runs more efficiently if you don’t select text.

      • #960560

        Hans you are the man!

        Thank you so much for all your help, it seems every time I have ever asked a question on WOPR you are right there to help me out.

        Thanks for the tip on not selecting the bookmark. I’ll alter my other code for more efficiency….

    Viewing 0 reply threads
    Reply To: Word Automation (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: