Opening microsoft office in a visual basic form

Posted on 2006-05-23
Last Modified: 2013-11-25

I'd like to know how I can open the microsoft word application (not just a .doc file - the real application) in a vb form. For example in a panel or something.... I think it has to do with OLE containers but I can't find any useful information on the internet...

Thank you.
Question by:silethunde
    LVL 76

    Assisted Solution

    The easiest way is to set a Reference in your Project to the Microsoft Word Object library.

    Dim wdApp as Word.Application
    Dim wdDoc as Word.Document

    Set wdApp = New Word.Application
    wdApp.Visible = True

    'you can then open a new document, if you like

    Set wdDoc = wdApp.Documents.Add
    LVL 76

    Accepted Solution

    If you want it on a form, place an OLE control on your form. This will bring up an Insert Object dialog and you can choose a Microsoft Word Document.
    LVL 2

    Assisted Solution

    You can place a Microsoft Web Browser ActiveX control on a form and host a Word document inside of it - load the file by using something like

        WebBrowser1.Navigate ("c:\temp\test.doc")

    You do need to have Word installed for this to work.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now