C Word Application
Oct 05, 2018 winword.exe is the executable file name for Microsoft Word which is used when Word is launched. The word WinWord stands for Windows Word (Microsoft Word). This software component is also used by other applications such as Outlook when attachments are to be viewed either in Outlook or in another window in Word.
-->Represents the Microsoft Word application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object.
Remarks
Use the Application property to return the Application object. The following example displays the user name for Word.
//Set status for word application is to be visible or not. Winword.Visible = false; //Create a missing variable for missing value object missing = System.Reflection.Missing.Value; //Create a new document; Microsoft.Office.Interop.Word.Document document = winword.Documents.Add(ref missing, ref missing, ref missing, ref missing). Jun 08, 2017 Application Object (Word) Represents the Microsoft Word application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object. Word document: word.doc One Two three C# program that uses Microsoft Word interop using System; using Microsoft.Office.Interop.Word; class Program static void Main // Open a doc file. Application application = new Application; Document document = application.Documents.Open('C:word.doc'); // Loop through all words in the document.
Many of the properties and methods that return the most common user-interface objects—such as the active document (ActiveDocument property)—can be used without the Application object qualifier. For example, instead of writing Application.ActiveDocument.PrintOut
, you can write ActiveDocument.PrintOut
. Properties and methods that can be used without the Application object qualifier are considered 'global.' To view the global properties and methods in the Object Browser, click <globals>
at the top of the list in the Classes box. (Also see the Global object.)
Remarks
To use Automation (formerly OLE Automation) to control Word from another application, use the Microsoft Visual Basic CreateObject or GetObject function to return a Word Application object. The following Microsoft Excel example starts Word (if it is not already running) and opens an existing document.
Events
Methods
Properties
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
I'm using WinForms. I have a form that has a button.
Goal: On button click: Open up a word document. Where the file path is hard coded into the program. I don't want the users to have to locate the word document.
Problem: I receive this error message. When I wrote my code, I get a red error line under 'Application'.
taji01taji013 Answers
first add the dll of Microsoft.Office.Interop.Word
to your references then add this:
and use the following code:
atoMerzFree Microsoft Word Application Download
amit dayamaC Word For Application
Instead of adding interop in your reference, you may also consider to use this:
This Application
is not this.Application
it's Microsoft.Office.Interop.Word.Application
.
So you can use this code: