access MS word files in VB.net

  • 12 years ago

    Hello every one,

    I am trying to open, create Word documents using my windows form application. I am using VS 2005 on Vista. I found that we can do it by adding reference to "Microsoft Word 9.0 Object Library".

    In my VS 2005 I didn’t find "Microsoft Word 9.0 Object Library".  Is there a way to download it form some where. And does this support all versions of MS word?

    I found “Microsoft word 12.0 Object library” in my VS2005. Where can I get the documentation for this?
    Please help
    Thank you.



  • 12 years ago
    Hi,

    I have VS 2005 on XP pro and found " Microsoft Word 11.0 Object Library" in the Com references.
    After adding this component I've used this code to open MS Word.

     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim m_Doc As Word.Document
            Dim m_App As Word.Application
            m_App = New Word.Application
            m_Doc = m_App.Documents.Add(Template:="Normal.dot")

            m_App.Visible = True
        End Sub

    However if you just need to open a word document use:

    Process.Start("filepath.Doc")

    Wkr,





















Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” - Tom Cargill