Creating a Word Document with Excel VBA

  • Hello,


    I am working on a project where I am creating analysis using a subroutine in excel/vba and I would like to have the subroutine generate a report that is a word document. I have never used excel/vba to create and modify a word document and don't know how to approach it. I imagine that I will have a template.doc that I can access and save as another file. Does anyone have an example of creating and modify a word document in this manner. Any help is greatly appreciated.

  • Re: Creating a Word Document with Excel VBA


    Hi


    Welcome to Ozgrid forum. This is not my code but it can be adapt to what you want.


  • Re: Creating a Word Document with Excel VBA


    Thanks jetted.


    This is working well for me. I am going to do some looking around for more formatting options. If I have any specific questions after I do some looking around I will post another question. Thanks for your help.

  • Re: Creating a Word Document with Excel VBA


    I have a similar problem. I have an excel sheet with multiple columns. Would like to populate that table format in a word doc. Any pointers?

  • Re: Creating a Word Document with Excel VBA


    The simplest way:


    Code
    Sub M_snb()
        With CreateObject("Word.Document")
            .Windows(1).Visible = True
            .Content = "Example"
        End With
    End Sub
  • Re: Creating a Word Document with Excel VBA


    Hi there!
    Sorry to ask this, but I am having trouble creating a word document named after the active cell and based on a specific template. After this document is created, the document should open.
    Does anyone have a code for that?
    Thank you very much!!

  • Re: Creating a Word Document with Excel VBA


    hfalstom


    Welcome to the Forum. Please take the time to read our Forum Rules


    Please start your own post. Posting in another member's Thread is known as hijacking and is not allowed here. By all means add a link to a Thread that may be related to your question.

Participate now!

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