Word and COM

Posted on 2004-08-18
Last Modified: 2008-02-01

Ok so I tried to mimick the code C# in PHP, came up with the following code:


$word = new COM("Word.Application") or die("Unable to create Word");

$word->Visible = TRUE;

$empty = new VARIANT();


$word->Selection->Find->Text = "Php";

$word->Selection->Find->Replacement->Text = "Hi";




And it does not seem to work. It just times out, can somebody see what I might be missing?
Question by:drakkarnoir
  • 2

Author Comment

Comment Utility
Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `WdReplace': Unknown name. ' in C:\word.php:25 Stack trace: #0 {main} thrown in C:\word.php on line 25

Accepted Solution

petoskey-001 earned 500 total points
Comment Utility
I've seen this before.  Try the code from this previous answer and see if it works for you.

Author Comment

Comment Utility
Going to do this with .NET, thanks guys.

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now