Template population

  • Hi,

    I'm new to Word Macros. However, I have a template that needs to be populated via a form. I was wondering what is the best way to do this, shall I place the text from the form into text fields on the document, these text fields must contain an address block, name etc.

    Cos in excel its simple just place the value of the text box into a cell. However, I am unsure how to approach this.


  • Re: Template population

    Hi and welcome,

    Basically, you'll need Excel to open up a word template

    Set wordApp = GetObject(, "Word.Application")
    Set wordDoc = wordApp.Documents.Open(FileName:="C:\BasicMemo.dot")


    Then populate the fields in the template using

    wordDoc.Fields(1).Result.Text = UserForm.TextBox1.Value

    You will obviously need to insert the fields into the document

    You can name the fields but it seems easier to just go through them by number.

    Hope this gets you started.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!