[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Opening microsoft office in a visual basic form


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.
  • 2
3 Solutions
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
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.
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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now