From:             David dot Richards at Tools dot co dot uk
Operating system: Windows XP Pro SP1
PHP version:      4.3.3RC2
PHP Bug Type:     COM related
Bug description:  Incompatible variant type in call to MailMerge.OpenDataSource

Description:
------------
When trying to call the OpenDataSource method of the MailMerge object in
Word(Office XP Pro SP2) the following error is displayed in the web
browser:-

Warning: (null)(): Invoke() failed: Type mismatch. Argument: 17 in
c:\program files\apache group\apache\htdocs\test6.php on line 93

I have checked what data types OpenDataSource is expecting and according
to
OLE/COM viewer, it is expecting a BSTR followed by 15 optional variants.

The call accepts the BSTR but trying to specify any of the optional
variants produces the error(optional parameter are require or word prompts
the user to specify the table to use).  




Reproduce code:
---------------
$empty = new VARIANT();
$word = new COM("word.application") or die("Unable to instantiate Word");
$word->Visible = 1;
$word->Documents->Add();
$word->ActiveDocument->MailMerge->MainDocumentType = wdFormLetters;
$word->ActiveDocument->MailMerge->OpenDataSource
("c:\\temp\\test.xls",$empty,$empty,$empty,$empty,$empty,$empty,$empty,$empt
y,$empty,$empty,$empty,"SELECT * FROM test$");


Expected result:
----------------
1. Word opens.
2. Add new document.
3. Start mail merge using the sepcified data source

Actual result:
--------------
Word opens but the mail merge fails to open the data source, producing the
error above.

-- 
Edit bug report at http://bugs.php.net/?id=24962&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24962&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24962&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24962&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24962&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24962&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24962&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24962&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24962&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24962&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24962&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24962&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24962&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24962&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24962&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24962&r=gnused

Reply via email to