====== OleCallMethod Function ====== ==== Description ==== Calls the MethodName method of the OLE object. ==== Syntax ==== ReturnValue = OleCallMethod(object, MethodName[, Arg1, Arg2, ...]) ==== Parameters ==== The function has the following parameters: ^Parameter^Description^ |object|The Ole object.| |methodname|The name of the method to call.| |Arg1 .. argN|Any arguments necessary to the call of the method.|| ==== Returns ==== ==== Remarks ==== The OleCreateInstance function is used to create instances of an OLE Object for use in Basic+ scripts and must be issued prior to calling the OleCallMethod. ==== See Also ==== [[olecreateinstance|OleCreateInstance]] function, [[olegetproperty|OleGetProperty]] function, [[oleputproperty|OlePutProperty]] subroutine, [[olestatus|OleStatus]] function ==== Example ==== subroutine Test_OLE_Basic_PDF(void) declare subroutine OlePutProperty, Msg declare function OleCreateInstance, OleGetProperty, OleCallMethod, OleStatus // Create the Ole Object for VSPrinter oleObj = OleCreateInstance('VSPRINTER7.VSPRINTER.1') status = OleStatus() if status then msg(@window,'OLE Error code: ':status) return end // Get the AbortCaption property of the VSPrinter Print window property1 = OleGetProperty(oleObj, 'AbortCaption') status = OleStatus() if status then msg(@window,'OLE Error code: ':status) end // Change the AbortCaption property of the VSPrinter Print window OlePutProperty(oleObj, 'AbortCaption', 'Testing...') status = OleStatus() if status then msg(@window,'OLE Error code: ':status) end // Get the AbortCaption property of the VSPrinter Print window after it has been changed property2 = OleGetProperty(oleObj, 'AbortCaption') status = OleStatus() if status then msg(@window,'OLE Error code: ':status) end // Calls the STARTDOC method of the ole object to begin printing the document. ReturnValue = OleCallMethod(oleObj, "STARTDOC") status = OleStatus() if status then msg(@window,'OLE Error code: ':status) end // Create the text to print text = "OpenInsight is the only database development and application environment that provides both Windows, " text: = "Linux and Java-based GUI tools to develop and deploy web-based and client server applications that " text: = "support native XML, SQL, Lotus Notes. There are 1.6 mm licenses of Revelation products across 80k " text: = "deployed sites worldwide." // Print the text OlePutProperty(oleObj,"TEXT",text) status = OleStatus() if status then msg(@window,'OLE Error code: ':status) end // End the print job ReturnValue = OleCallMethod(oleObj, "ENDDOC") status = OleStatus() if OleStatus() then msg(@window,'OLE Error code: ':status) end // Save the text to a temp file for use in the VSPDF OLE object returnValue = OleCallMethod(oleObj,"SAVEDOC","pdftemp.txt") status = OleStatus() if OleStatus() then msg(@window,'OLE Error code: ':status) end // Start the VSPDF OLE object to create the pdf file oleObj2 = OleCreateInstance('VSPDF.VSPDF.1') status = OleStatus() if OleStatus() then msg(@window,'OLE Error code: ':status) return end // Create the PDF file returnvalue = OleCallMethod(oleObj2,"convertfile","pdftemp.txt","C:\temp\new_ole_func.pdf") status = OleStatus() if OleStatus() then msg(@window,'OLE Error code: ':status) end return