I've been racking my brains all day trying to get this working and I'm now turning to all of you for help. I've chopped up the code I'm having problems with to the bare bones and hoping someone can help!
DEF VAR vWordHand AS COM-HANDLE.
DEF VAR vWordOpenfileHand AS COM-HANDLE.
DEF VAR vWordDataSourceDocHand AS COM-HANDLE.
CREATE "Word.Application":U vWordHand NO-ERROR.
IF VALID-HANDLE (vWordHand) THEN
ASSIGN vWordHand:VISIBLE = YES.
vWordOpenfileHand = vWordHand:documents:open( "d:\test.doc", no, NO, no, "":U, "":U, no, "":U, "":U, 0 ).
vWordDataSourceDocHand = vWordHand:ActiveDocument.
vWordHand:Visible = YES.
DEFINE INPUT PARAMETER pActiveDoc AS COM-HANDLE.
DEFINE INPUT-OUTPUT PARAMETER Cancel AS LOGICAL.
MESSAGE "test" VIEW-AS ALERT-BOX.
This will launch word and open the specified document. If you manage to press file/new(then create in 2007) within 10 seconds, a progress message box pops up. GREAT! Now try again only hit file/print. I then get:
Routine mismatched parameters. (2570)
My DocumentBeforePrint procedure matches exactly what the COM Object viewer is asking for. I've changed the data types, parameter types with no success.
Does anyone know how to tell what parameters are being passed? Or better yet, does anyone have any clue how to make this work?
I am testing this against Word 2007. If that version is the issue, it would be good to know, but I still need it to work against both 2003 and 2007.
Thank you all in advance!
KB-P43140: Error# 2570 firing COM Object event procedures for Microsoft Excel.
Accessing an Excel Spreadsheet from Progress 4GL using ActiveX
Enabled event notification for the Excel Automation Object via
Attempting to execute a couple of different COM Object event
procedures for the Excel's Workbook sub-object such as
WorkbookBeforePrint, WorkbookBeforeSave and WorkbookBeforeClose.
Procedure mismatched parameters.
This is a known issue.
The problem is related to the first event procedure's input parameter,
which is defined as COM-HANDLE and represents the Workbook
sub-application. To get around this issue, change its data type from
COM-HANDLE to HANDLE. If there is a need to make a reference to the
Workbook object from the event procedure's code, then use a COM-HANDLE
variable whose scope is the entire program and points to that same
ARGH! Thank you! Guess my queries were too Word specific!