Rapid-Q Documentation by William Yu (c)1999 Appendix A: QOLEOBJECT

QOLEOBJECT Component

QOleObject implements an automation client. Type checking is disabled for this component, see examples on how this can help you. This component is currently in an experimental stage. Longs, Doubles, and Strings are currently supported, other data types may be added later.

QOleObject Properties
FieldType R/WDefault
Container QOLECONTAINER W 

QOleObject Methods
MethodTypeDescriptionParams
CreateObjectFUNCTION (ClassName AS STRING) AS INTEGERCreate COM object, with actual name or CLSID1
CreateRemoteFUNCTION (Host AS STRING, ClassName AS STRING) AS INTEGERCreate remote COM object, with actual name or CLSID2
FreeSUBRelease object0
GetIDofNameFUNCTION (Name AS STRING) AS INTEGERReturns the ID of an identifier, good for checking if it exists. Returns -1 if name is not found.1
GetObjectFUNCTION (ClassName AS STRING) AS INTEGERGet active COM object, with actual name or CLSID1
InvokeFUNCTIONI (ID AS STRING, Params, ...) AS VARIANTInvoke method/propertyInfinite
InvokeCopySUB (ID AS STRING, Object AS QOLEOBJECT)Copy object (might not work... yet)2

QOleObject Events
EventTypeOccurs when...Params

 

Word.Basic Methods  - WRDBASIC.HLP
 

MethodParams TypeDescription
FileOpen FileName  string The name of the document (paths are accepted).
ConfirmConversions integer True to display the Convert File dialog box if the file isn't in Microsoft Word format
ReadOnly  integer True to open the document as read-only.
 Note This argument doesn't override the read-only recommended setting on a saved document. For example, if a document has been saved with read-only recommended turned on, setting the ReadOnly argument to False will not cause the file to be opened as read/write.
AddToMru  integer. True to add the file name to the list of recently used files at the bottom of the File menu.
DummyParam integer Needed for XP Office
PasswordDoc string The password for opening the document.
PasswordDot stringThe password for opening the template.
Revert long Controls what happens if FileName is the name of an open document.
True
to discard any unsaved changes to the open document and reopen the file. False to activate the open document.
WritePasswordDoc string The password for saving changes to the document.
WritePasswordDot string The password for saving changes to the template.
Dummy string 
Dummy string 
Dummy string 
FormatOpen longThe file converter to be used to open the document. Can be one of the following  constants

 wdOpenFormatAuto = 0
wdOpenFormatDocument = 1
wdOpenFormatTemplate = 2
wdOpenFormatRTF = 3
wdOpenFormatText = 4
wdOpenFormatUnicodeText = 5
wdOpenFormatEncodedText = 5
wdOpenFormatAllWord = 6
wdOpenFormatWebPages = 7

CodePage longThe document encoding (code page or character set) to be used by Microsoft Word when you view the saved document. Can be any valid MsoEncoding constant.
Visible longTrue if the document is opened in a visible window. The default value is True.
DummyParam long 
OpenConflictDocument longSpecifies whether to open the conflict file for a document with an offline conflict.
OpenAndRepair longTrue to repair the document to prevent document corruption.
DocumentDirection longIndicates the horizontal flow of text in a document.
wdLeftToRight = 0
wdRightToLeft = 1
 
NoEncodingDialog long. True to skip displaying the Encoding dialog box that Word displays if the text encoding cannot be recognized. The default value is False.

Excel.Properties

QOleObject Examples

' This example requires MS WORD
' If you're using a localized version with a foreign language,
' you'll have to adjust the parameter names to match.
' Comments in italics indicate the old style syntax before
' type checking was disabled.  You can choose either approach.

$ESCAPECHARS ON

DIM Object AS QOLEOBJECT

'Object.CreateObject("{000209FE-0000-0000-C000-000000000046}")
Object.CreateObject("Word.Basic")
'Object.Invoke("AppShow")
Object.AppShow
'Object.Invoke("AppMaximize", "", 1)
Object.AppMaximize("", 1)
'Object.Invoke("FileNew")
Object.FileNew

PRINT Object.Bold  '-- is bold enabled?

Object.Insert("Hello world!\n")
Object.Bold

PRINT Object.Bold  '-- Bold should be enabled

Object.Insert("Rapid-Q is awesome!\n")
Object.Bold(0)     '-- Turn Bold off

SLEEP 5

Object.Free
----------------------------------------------
DIM WordObject AS QOLEOBJECT

filename$="C:\BAS\RAPIDQ\ole\hamai40.doc"
ConfirmConversions=1
ReadOnly=0
AddToRecentFiles =1
DummyInt=0
PasswordDoc$="qq"
PasswordTmp$ ="rr"
Revert =0
WritePasswordDocument$ =""
WritePasswordTemplate$ =""
DummyStr=""
'--------------------------'
FormatOpen =5'' wdOpenFormatEncodedText
CodePage =866
Visible =1
OpenConflictDocument =1
OpenAndRepair =1
DocumentDirection =1
NoEncodingDialog =1


WordObject.CreateObject("Word.Basic")
WordObject.AppShow

with WordObject

.fileOpen(filename$,ConfirmConversions,ReadOnly, AddToRecentFiles ,DummyInt, PasswordDoc$, PasswordDoc$, Revert , _
 WritePasswordDocument$,WritePasswordTemplate$,DummyStr$,DummyStr$,DummyStr$,FormatOpen ,CodePage,Visible, _
DummyParam,OpenConflictDocument,OpenAndRepair,DocumentDirection,NoEncodingDialog)

.TableInsertTable(0, 3, 5) 

.Free
end with


Prev Component Contents Next Component