ID: 9141
User Update by: [EMAIL PROTECTED]
Status: Closed
Bug Type: COM related
Description: cannot call a COM function opening a word appli
<?php
// get a web page into an array .
$Obj = new com('prjWord.clsWord');
echo "Loaded {$Obj}";
echo "<br>";
$Obj->filename1 = 'C:shanky2.doc';
$Obj->setFile();
?>
shanky2.doc is the file to be read.
And this is the function in the Com component which gives error, otherwise other
normal fuctions work properly.
Public Function setFile()
Set wproc = CreateObject("Word.Application")
wproc.Visible = False
wproc.Documents.Open (filename)
str1 = Mid(filename1, 1, Len(filename) - 3) & "txt"
wproc.ActiveDocument.SaveAs str1, wdFormatText
wproc.Quit
End Function
Previous Comments:
---------------------------------------------------------------------------
[2001-02-08 10:13:17] [EMAIL PROTECTED]
i can't follow you, you're calling a function that requires a parameter without it,
how should this work ?
try $Obj->setFile("whatever.doc");
harald.
---------------------------------------------------------------------------
[2001-02-08 04:28:21] [EMAIL PROTECTED]
<?php
// get a web page into an array .
$Obj = new com('prjWord.clsWord');
echo "Loaded {$Obj}";
echo "<br>";
$Obj->filename1 = 'C:shanky2.doc';
$Obj->setFile();
?>
shanky2.doc is the file to be read.
And this is the function in the Com component which gives error, otherwise other
normal fuctions work properly.
Public Function setFile(filename as String)
Set wproc = CreateObject("Word.Application")
wproc.Visible = False
wproc.Documents.Open (filename)
str1 = Mid(filename, 1, Len(filename) - 3) & "txt"
wproc.ActiveDocument.SaveAs str1, wdFormatText
wproc.Quit
End Function
---------------------------------------------------------------------------
[2001-02-07 07:28:42] [EMAIL PROTECTED]
could you paste your php code and not this vb crap.
harald.
---------------------------------------------------------------------------
[2001-02-07 00:15:16] [EMAIL PROTECTED]
This is the COM function being called from PHP.
Public Function setFile(filename as String)
Set wproc = CreateObject("Word.Application")
wproc.Visible = False
wproc.Documents.Open (filename)
str1 = Mid(filename, 1, Len(filename) - 3) & "txt"
wproc.ActiveDocument.SaveAs str1, wdFormatText
wproc.Quit
End Function
The error message popped is Invoke failed exception in the line where function is
called.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=9141
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]