
Click OK to add the WebBrowser control to the Windows Forms toolbox. On the COM Components tab, add a reference to the Microsoft WebBrowser. On the Tools menu, click Customize ToolBox to open the Customize ToolBox dialog box. NET, create a Windows Application project by using Visual Basic 2005 or Visual Basic. In Microsoft Visual Studio 2005 or in Microsoft Visual Studio. The document opens inside the WebBrowser control, and a message box that displays the name of the Office document server appears Method 1 When you click Browse, the Open dialog box appears and allows you to browse to a Word, Excel, or PowerPoint file. The file is where the Windows Forms Designer writes the code that implements all the actions that you performed by dragging and dropping controls from the Toolbox.Īfter the Visual Basic application is created, Press F5 to run the project. The two files that represent the form are named Form1.vb and. By default, Visual Basic adds one form to the project when you create a Windows Forms project.

When you use two methods above to create a Visual Basic application that opens Office documents, you must change the code in Visual Studio 2005. Creating a Visual Basic application that opens Office documents

The WebBrowser control (Shdocvw.dll) is a part of Internet Explorer and can only be used on systems that have Internet Explorer installed. NET and Visual Basic 2005 do not currently support hosting ActiveX documents directly, you may use the WebBrowser control for this purpose. An ActiveX document that is hosted in the WebBrowser control is always active therefore, unlike traditional OLE embedded objects, there is no sense of in-place activation. Instead, it is considered in itself a complete document that is merely being viewed (such as with Microsoft Internet Explorer) or collected in a single resource with other documents (such as a Microsoft Office Binder file). Unlike a traditional embedded object, an ActiveX document is not designed to be a contained object in a larger document. More InformationĪctiveX documents are embeddable OLE objects that behave more like ActiveX controls than traditional OLE objects. This article demonstrates how to browse to an existing Office document and display it in a Visual Basic form by using the WebBrowser control. If you want to embed an existing document and open it as an in-place ActiveX document object within a Visual Basic form, a potential solution for you is to use the WebBrowser control. NET do not provide an OLE control that lets you embed an Office document in a form.

Microsoft Visual Basic 2005 and Visual Basic. You may want to display, or embed, a Microsoft Office document directly on a Microsoft Visual Basic form. For a Microsoft Visual C# 2005 and Microsoft Visual C#.
