Connecttoobject ()
Function: open a specified file and connect it to the corresponding server application.ProgramWhen necessary, start the corresponding server.
Syntax: oleobject. connecttoobject (filename {, classname })
Parameter: oleobject: variable name of oleobject.
Filename: string type. Its value is the file name of the OLE storage file. The application can also specify this parameter as a null string (""). In this case, you must use the classname parameter. The oleobject variable is connected to the current active object of the server application specified by classname.
Classname: string type, optional. Its value is the class name of the OLE class. It specifies the OLE server application and the type of objects that the server can operate on through Ole. If this parameter is omitted, PowerBuilder uses the Extension Section of the file name in the filename parameter to determine which server application to start.
Instance 1:
Integer result
Oleobject myoleobject
Myoleobject = create oleobject
Result = myoleobject. connecttoobject ("", "Excel. application ")
Instance 2:
Integer result
Oleobject myoleobject
Myoleobject = create oleobject
Result = myoleobject. connecttoobject ("C: \ Excel \ expense.xls", "Excel. Chart ")
Problem:
Oleobject. connecttoobject (filename {, classname })
Where can I call classname?
Open the Object Browser in the PowerBuilder development environment, click the OLE tag, and list the oleobject objects installed in the system under the "programmable object" project. Expand an object to view the "versionlndependerprogid" of "class information. :