Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    33

    Unanswered: How to generate word files in a folder automatically?

    Suppost that I have a database [CustomerTable](CustName, Website, ActiveDate)

    Now I need to create a process to come out as the following results:

    1. Generate different folder for each ActiveDate, with folder name such as "07-19-2004"
    2. In each folder, generate a welcome word(.doc) file for each customer, with file name like "John Smith - welcome file.doc"
    3. In the welcom file, all the content is the same except the CustName, the Website, Address.

    For Example: There are 10 customers active their service today. And their information is added to [CustomerTable].

    now I need to have a process so that I generate a folder named "07-19-2004".

    In this folder, there are 10 .doc word file as following:
    CustName1 - welcome file.doc
    CustName2 - welcome file.doc
    .
    .
    .
    CustName10 - welcome file.doc

    The content of each welcome file:

    Dear [CustName1],

    You have got your URL as [Website]. Please confirm your start service date as [ActiveDate].




    I have no clue on how to achieve this project. Could anyone can have a piece of advice would be very helpful. Please!

    Thank you in advanced.

  2. #2
    Join Date
    Apr 2003
    Location
    Alabama, USA
    Posts
    154
    I've got a sample db file that shows you how to create folders. You would just have to adapt the code to name the folder from within VBA. See here.

    As for #2 & #3, you could create a report as a word document and use code to export it into the created folder. Set the record source for the report by looping though the table (CustomerTable) for each new record added 07-19-2004.

    Hope this gives you a starting point!
    http://AccessDB.Info

    You live and learn. At any rate, you live. - Douglas Adams

  3. #3
    Join Date
    Feb 2004
    Posts
    33
    Thanks for your kindness response. It does give me the clue of starting my work. I am reading the articles about the FileSystemObject.

    It seems that the FileSystemObject is not default in VBA of Access . The link you gave me shows that it can be found in Scrrun.dll? So I went to the VBA screen, choose the tool->Reference-> Microsoft Scripting Runtime->OK. Is that the way I can active the FileSystemObject? Do I need to do anything else to have it?

    Really appreciate your help again.


    Quote Originally Posted by Cosmos75
    I've got a sample db file that shows you how to create folders. You would just have to adapt the code to name the folder from within VBA. See here.

    As for #2 & #3, you could create a report as a word document and use code to export it into the created folder. Set the record source for the report by looping though the table (CustomerTable) for each new record added 07-19-2004.

    Hope this gives you a starting point!
    Last edited by leau; 07-20-04 at 11:10.

Posting Permissions

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