Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Apr 2003
    Location
    Rio de Janeiro, Bay of Plenty, Brazil
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can I do to fill in a Word document usin g VBA (1/1)

    I have a template Word doc and I need to put some information in some ranges via VBA in order to automating that filled up.

    For example. This Word doc below will have different "Team Member Name" sometimes as well as "Reporting Period" and "Project Name".
    Below in the "Status of Activities and Tasks" I need to put some information along the columns "Deliverable/Task Description, Period Compl. Date and so on.
    After all I will need to put some Client Contacts and Comments automatically everything using VBA coding.
    Team Member Status Report
    Team Member Name

    Reporting Period


    Project Name





    Status of Activities and Tasks


    Deliverable/

    Task Description
    Planned

    Compl.

    Date
    Actual Compl.

    Date
    Status

    Code
    % Complete
    Hours Remaining




    Comment














    Concerns/Issues



    Scheduled Tasks/Activities





    Client Contacts



    Comments

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How can I do to fill in a Word document usin g VBA (1/1)

    You can set document variables in VBA, and place DocVariable fields in the document that refer to these variables. See <post#=259,183>post 259,183</post#> for a demo - it employs a userform to set document variables, and the page header contains DocVariable fields that display the value of these variables.

    Alternatively, you could use custom document properties and DocProperty fields. Custom document properties can be edited by the user in Document Properties; this can be an advantage or a disadvantage depending on your requirements.

  3. #3
    New Lounger
    Join Date
    Apr 2003
    Location
    Rio de Janeiro, Bay of Plenty, Brazil
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How can I do to fill in a Word document usin g VBA (1/1)

    Is there how to fill the fields of th documents like Excel (cells) ? As I showed in the prior post the template has some tables and some paragraphs. Actually I need to fill all the ranges in the tables and all the paragraphs via VBA quite using none userforms. Indeed the data will be charge the cells using database records (SQL Server). The logic to get the data from this database I have complete. I just need to populate the cells of the Word document. Thanks.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How can I do to fill in a Word document usin g VBA (1/1)

    If the data come from a database, consider using a mail merge.

  5. #5
    New Lounger
    Join Date
    Apr 2003
    Location
    Rio de Janeiro, Bay of Plenty, Brazil
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How can I do to fill in a Word document usin g VBA (1/1)

    Do you have some coding example because I don't have much expertise using VBA in Word just in Excel ? Thanks

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How can I do to fill in a Word document usin g VBA (1/1)

    You don't need VBA to do a mail merge, use the mail merge wizard.

  7. #7
    New Lounger
    Join Date
    Apr 2003
    Location
    Rio de Janeiro, Bay of Plenty, Brazil
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How can I do to fill in a Word document usin g VBA (1/1)

    Dear Hans

    I have a project which is written in VBA inside a workbook Excel. Into this VBA code I will need to populate some Word documents using the same data come from a database when accessed the SQL Server. Afterwards the Word document will be saved and send to the user.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How can I do to fill in a Word document usin g VBA (1/1)

    See WendellB's tutorial Automation 101 - it contains lots of useful links.

Posting Permissions

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