Results 1 to 7 of 7
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    update fields (Word 2002 XP SR3)

    We have an internal system, which exports all its data into a text file .txt.

    It launches Word, and from a template a new document is created. Data from the text file is inserted into fields in the Word document.

    The hand over is complete.

    I'm finding that the fieldcodes display "Error! No document variable supplied". When i manually update the fieldcodes the fields update.

    In some systems, I've seen a "PostModule" which the system calls to implement clean up code. I dont have this luxury.

    Once the hand over is complete its essentially a flat document. Is there anyway i can run the code to update all fields?

    diana

  2. #2
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: update fields (Word 2002 XP SR3)

    Hi Dians
    Try
    ActiveDocument.Fields.Update

    HTH
    Regards
    Don

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update fields (Word 2002 XP SR3)

    Thanks Don

    I will place that code in a Class module, application event. but which one... mmm... <img src=/S/thinks.gif border=0 alt=thinks width=15 height=15>

    diana

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update fields (Word 2002 XP SR3)

    I've been looking at application or document events.

    I'm wondering which event is the best event to add code to update all fields?

    On a newly created document I want to update all my fields the one time.

    Private Sub App_DocumentChange() - wouldnt really be applicable, as each time the document changes, code will be run to update all fields. and I was wanting to update the fields once on a newly created document

    Is there anywhere I can read up about events?

    any ideas? <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

    diana

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: update fields (Word 2002 XP SR3)

    You could put this in the Document_Open event. This would then update the fields each time you open the document.

    You can find more information about Word events here.

    StuartR

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: update fields (Word 2002 XP SR3)

    Would the Document_Open event be applicable?

    As the internal system generates and opens a Word document, the fields are populated with data after the document is opened?

    diana

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: update fields (Word 2002 XP SR3)

    Which event you need partly depends on how you are using the document.

    I had assumed that after your external application created this document a user opened it with Word, and that the fields could be updated when the user opened it.

    Can you describe your workflow a bit better and we can try to think of alternatives for you.

    StuartR

Posting Permissions

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