Please enable JavaScript to view this site.

thinBasic Help Manual

Navigation: ThinBASIC Modules > COM

COM_CreateObject

Scroll Prev Top Next More

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Creates a reference to a COM Server application.

 

Syntax

 

pIDispatch = COM_CreateObject(sServerName [, ErrorVar])

 

Returns

 

A DWord pointer to IDispatch

 

Parameters

 

Name

Type

Optional

Meaning

sServerName

String

No

Name of the COM server to create

ErrorVar

Variable

Yes

Must be a LONG variables passed by reference. If present it will be filled with an error code if an error occurs

 

Remarks

 

Restrictions

 

See also

 

Examples

 

USES "COM"

 

Dim pXlApp    As DWORD

Dim RetVal    As LONG

 

'---Try to create an Excel application reference

pXlApp = COM_CreateObject("Excel.Application", RetVal)

 

'---Do something ...

 

'--- Time to release the allocated interface objects

If ISFALSE(COM_Succeeded(COM_Release(pXlSheet))) Then

  MSGBOX 0, "ActiveSheet release fails"

End If

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software