• Automation with Word

    Author
    Topic
    #1768131

    I’m sure this should be easy – but…! I have a database of addresses, with fields called Name, Add1, Add2 etc. What I want to be able to do is send the contents of the first field of the current record to the currently active Word Document at the current cursor location, then put a paragraph mark, the 2nd field, paragraph mark etc. But I can’t figure out HOW! Any suggestions?

    Viewing 1 reply thread
    Author
    Replies
    • #1777862

      Sounds like a pretty straight-forward Mail Merge operation from within Word.

      You just need to separate the Merge Fields in Word with a carriage return. That will give you one field per line, and one document per record.

      Good Luck.

      Rich P.

      • #1777875

        I obviously didn’t explain myself properly – if it was mail merge, I’d be happy – I could even do this AS a mail merge by writing a file from the current record. BUT what I’m trying to do to help a friend is to reach a point where the database can be used to address ANY active document, simply by clicking a button in Access which would send the active record across to the document. I had assumed that creating an object of Word.Application would work, but when I did this yesterday I was getting odd error messages. Today of course, it’s working fine so maybe I’m just being paranoid?!

    • #1777864

      If you want to do it in Access you can use vbCrLf constant.
      In code it should look like this:

      field1 & vbCrLf & field2 & vbCrLf & field3

      It is often easier to do a mailmerge with Word!

    Viewing 1 reply thread
    Reply To: Automation with Word

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

    Your information: