3

I have a proprietary program that requires users to occasionally make very minor edits to a word document. I want to replace Word with LibreOffice Writer. I have Writer set to open .doc and .docx files without a problem. However, when users generate and open these files through the proprietary software they get an error about being unable to find word.

I suspect that the program is hard coded to look for winword.exe. Is there a way to move and rename LibreOffice writer to winword.exe? Is there some sort of redirect file I can make? Not sure how to proceed from here.

3 Answers 3

4

Since you seem to have a working relationship with the proprietary software vendor, perhaps you can ask them how they are calling winword.exe to open the file. If they are simply making a system call to start winword.exe and passing it the name of the file to open, then all or most of the solutions I list below should work. I'll list the easiest ones first. If they are using COM or DDE, it is not impossible to intercept that, but will require considerably more work.

If they indicate that they are making a system call to start winword.exe (or if they won't tell you, just assume it may work and try it...):

  1. Go to the folder where LibreOffice Writer is installed. I am using OpenOffice instead of LibreOffice, but they are very similar, so you may have to do a little hunting/investigating.
  2. Find the "Writer" .exe file. For me (OpenOffice) it is:
    D:\Program Files\OpenOffice.org-3\program\swriter.exe
  3. Make a copy of the "Writer" .exe file that you find and rename it to "winword.exe".
  4. Make sure it remains in the same folder as the existing "Writer" .exe file.
  5. Make sure the folder where this is found is named in the "Path" environment variable.

If you have any problems or questions with this process, just provide some details in a comment.


If the above does not work, you could try "Redirecting" the opening of Winword. Two possibilities to do this:

Method 1:

  1. Create a link to LibreOffice Writer. Name the link winword.lnk or winword.exe.lnk. This may depend on how the proprietary program calls Winword.
  2. Place the link file in a folder named in the "Path" environment variable.

Depending on the version of Windows you are using, there may be more than one type of link that can be created, and some may work in your case and others may not.

Method 2:

  1. Using a programming language that can compile to a ".exe" file (like C or Visual Basic), create a small "wrapper" program.
  2. The wrapper program simply accepts the command line arguments and calls LibreOffice Writer, passing the arguments.
  3. After compiling the wrapper, rename the .exe file created to winword.exe and place it in a folder named in the "Path" environment variable.

If you find none of these work, or if they tell you they use DDE or COM to invoke Winword, then both Visual Basic and C can be programmed to respond to DDE/COM messages/requests, although this is not a trivial task.


Edit:

You can view the "Path" variable like this:

  1. Open a command prompt by clicking the Windows Start button (Start orb), then clicking the "Command Prompt" shortcut. If you don't see a "Command Prompt" shortcut on the start menu then click in the "Search" box at the bottom of the start menu and type:
    cmd.exe Enter
  2. In the Command Prompt window, type:

C:>echo %Path%
C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem

C:>

This will display a string that is a list of folders separated by ";" (semi-colons). The string displayed on your computer will be different.

If you cannot find your appropriate folder in the list of folders contained in the Path variable, you can add folder names to the Path:

  1. Click the Start button (orb)
  2. On the start menu, click Computer to open "My Computer", then click "System Properties" from the context menu below the menu bar. Or, on the start menu, right click Computer and select "Properties"
  3. On the left of the "My Computer" window, click "Advanced system settings"
  4. Click the "Advanced" tab.
  5. Click the Environment Variables button

    From this little window that opens, you can add/edit/delete environment variables.

    There are two types of environment variables. System variables are available to all users on the computer. User variables can be set to be different for each user.

    The top half of the window is for managing User variables, and the bottom is for managing System variables. To manage variables for only the logged-in user, work in the User variables section, otherwise work in the System variables section.

    If a variable has a value for both the System variables and User variables sections, then the value in the User variables section will take precedence.

    Variable names are not case sensitive, so a variable named "Path" might be spelled "path" or "PATH". Any way, it is the same variable.

    Assume you want to edit the "Path" in the System variables section (which would be the usual case).

  1. In the System variables section, find the Path variable, and click on it. Then click the Edit... button.
  2. If you do not find the Path variable (you most certainly will), you can click the New... button to add a new Variable and give it a name of Path.
  3. In the Edit System Variable window, click in the "Variable value" field (textbox).

    For the sake of safety, it would be a good idea to make a copy of the text (value) that is currently in the textbox and save it in a text file on your desktop.

  4. Add a folder to the current Path variable by moving to the end text in the textbox, then type a ; (semi-colon), and then type the full path of the folder you want to add, and click the OK button.

So in your case, you might see the value of the Path variable starts out looking something like this: C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem

and after you have added the folder to the Path variable it might look something like this: C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem;D:\Program Files\LibreOffice\program\

You can now click the OK button to close the System Properties window, and you can close the My Computer window.

The environment variables are typically only read by programs when they start. So, any program that starts after you change the value of an environment variable, or add a new environment variable, or delete an environment variable, will usually see the environment containing the new (changed) values.

For programs that are already running, you may have to close and restart them, or reboot the computer before they see the new (changed) values.

2
  • Kevin, thanks for the detailed answer. I'm having trouble following this step "Make sure the folder where this is found is named in the "path" environment variable." what exactly does this entail?
    – Jason
    Apr 23, 2013 at 21:11
  • @Jason - Since I provided a few solutions, I don't know which solution you're having trouble with. I added to my answer describing how to see the current value of the Path variable, and how to edit it if you need to. In case you are still having trouble, let me know which solution you are trying, and which folder your (LibreOffice) swriter.exe file is in, and what is contained in your Path variable, and what trouble you are having. I'll try to walk you through it. Apr 24, 2013 at 0:01
1

The software may not be looking for WinWord.exe, it may be trying to communicate with it using OLE Automation/COM, and when it fails to start the OLE, it reports it can't find it.

More info from MSDN: Automation

LibreOffice's Writer can act as a COM server to provide similar automation, but the software that's trying to automate Word/Writer would need to be reprogrammed to use it, including its different namespaces, ClassId's, methods etc.

If you suspect it's trying to run WinWord.exe specifically, then perhaps fire up a copy of Process Monitor to confirm or deny it with a little testing.

0

Probably not. You can't just rename a file to fit because usually the Program will be called and have Parameters passed to it / its functions.

Ask the developers of the proprietary Application if they would consider extending beyond Word - bare in mind that this is unpaid work for them so it will be a customer wish which they may grant some time in the future but certainly not right now.

Why not just open the docs manually to edit with Libre?

1
  • 1
    The devs say that word is their processor of choice and they wont expand support to other programs. The user opens the document from the software and not locally unfortunately
    – Jason
    Apr 23, 2013 at 19:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .