How to Open a Word Document With JavaScript

Written by erwin mcintosh
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Open a Word Document With JavaScript
Use lines of code to open a Word document with JavaScript. (Binary code around the world image by Maxim_Kazmin from

JavaScript is a computing platform, as well as a programming language. According to Java, many websites and applications will not be able to work without Java installed. If you want to open various Word and Excel documents using JavaScript, then you must understand how to use and write code and also where to store your code. PC users who want to open a Word document using JavaScript do so to enhance Web pages.

Skill level:


  1. 1

    Open your C: drive.

  2. 2

    Write the following code in your C: drive.

    <script type="text/javascript">

    function open Word(strFilePath) {

    var your Site = "";

    openWordDocPath(your Site + strFilePath);


    function openWordDocPath(strLocation) {

    var objWord;

    objWord = new ActiveXObject("Word.Application");

    objWord.Visible = true;




  3. 3

    Save the file of code that you just put into your C: drive.

  4. 4

    Open Microsoft Word and save a blank file as blank.doc.

  5. 5

    Close the file.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.