Code: Select all
<?php
$word = new COM('word.Application') or die('Unable to load Word');
com_load_typelib('word.Application');
$empty = new VARIANT();
print "Loaded Word, version {$word->Version}\n";
$word->Documents->Open('C:/Unfilled.DOC');
$word->Selection->GoTo(wdGoToBookmark, $empty, $empty, 'Robert');
$word->Selection->TypeText($_GET['YourName']);
$word->Selection->GoTo(wdGoToBookmark, $empty, $empty, '30');
$word->Selection->TypeText($_GET['YourAge']);
$word->Documents[1]->SaveAs("C:/{$_GET['YourName']}.doc");
$word->Quit();
$word->Release();
$word = null;
print "Word closed. \n";
?>I have tried giving all the permissions I can think of in dcomcnfg but it just will not launch. Any help please? Thank you in advanceFatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.Application': Access is denied. ' in C:\WEB_ROOT\wordtest.php:2 Stack trace: #0 C:\WEB_ROOT\wordtest.php(2): com->com('word.Applicatio...') #1 {main} thrown in C:\WEB_ROOT\wordtest.php on line 2