note: my account and my post have been deleted Why?!

Dear all

i tried this fine artical which guide hot to write php code to create ms office file using COM. … uments.htm

the problem that all the examples in this guide worked fine except the ms word example i am getting the following error:

this is the output:
I’m using MS Word 11.0
Fatal error: Call to a member function TypeText() on a non-object in C:Inetpubtempindex.php on line …

$word->Selection->TypeText(“Hello, universe!”); // error is here !

please help i tried everything…

note: i am using windows server 2003 sbs and php 5 and office 2003

ok i have another code which also give error and did know how to solve it

this the error :

Loaded Word, version 11.0
Fatal error: Uncaught exception ‘com_exception’ with message ‘Source: Microsoft Word
Description: Command failed’ in C:Inetpubtempindex.php:… Stack trace: #0 C:Inetpubtempindex.php(…): variant->Open(‘C:/inetpub/temp…’) #1 {main} thrown in C:Inetpubtempindex.php on line …


<?php //1. Instanciate Word $word = new COM("word.application") or die("Unable to instantiate Word"); print "Loaded Word, version {$word->Version}n"; //2. specify the MS Word template document (with Bookmark TODAYDATE inside) $template_file = "C:/Inetpub/temp/reminder.doc"; //3. open the template document $word->Documents->Open($template_file); //4. get the current date MM/DD/YYYY $current_date = date("m/d/Y"); //5. get the bookmark and create a new MS Word Range (to enable text substitution) $bookmarkname = "TODAYDATE"; $objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname); $range = $objBookmark->Range; //6. now substitute the bookmark with actual value $range->Text = $current_date; //7. save the template as a new document (c:/reminder_new.doc) $new_file = "C:/Inetpub/temp/reminder_new.doc"; $word->Documents[1]->SaveAs($new_file); //8. free the object $word->Quit(); $word->Release(); $word = null; ?>[/code]


Please do not complain about deletion of posts and/or accounts on the boards. Contact a staff member through PM if you have questions about moderation. Besides that, whoever did any deleting, I’m sure they had a good reason for doing so.

As for your PHP problem, have you tried contacting the person who wrote the script/article? I’m pretty sure they know more about the script they wrote than we do.


I apologize sincerely as it was I that deleted the posts.

I use a utility to help keep control of the Spammers that register here. When I looked at your information, it showed that you had 2 posts. When I tried to look up your posts, the search was unable to find them.

Thinking that you had found a way to modify your post count without actually posting (as I delete users that have a post count of 0 in a relatively short period of time), I deleted your posts and user account.

Later, however, I found where your posts were. (As the “Delete” tool I use only changes the text of the posts to “DELETED”) and I subsequently deleted those as well.

Please again, accept my sincerest apologies. It’s unfortunate, that I have to go through this routine on an almost daily basis to combat spammers. Unfortunately, you got caught accidentally.


thank you for the reply and your apologize accepted :D


again helloo help …!!!