How to call objects in VB3 style?

B

Brian

I am trying to call some Word functions from lotusscript which uses the VB3.0
syntax of passing parameters in order (instead of the paramname:=paramvalue
syntax).

Where can I find the correct order for the Word method calls?

I'm trying to do, for example, this:

Selection.InlineShapes.AddOLEObject ClassType:="Package", FileName:= _
"C:\Documents and
Settings\gallagb.CAIWIL\Desktop\dilbert-buzzword.jpg", _
LinkToFile:=True, DisplayAsIcon:=True, IconFileName:= _
"C:\WINDOWS\system32\cmmon32.exe", IconIndex:=0, IconLabel:= _
"C:\Documents and
Settings\gallagb.CAIWIL\Desktop\dilbert-buzzword.jpg"

But it would have to be like this:

Selection.InlineShapes.AddOLEObject option1, option2, ... etc.

Where can I find a reference that lists the correct order for the various
Word object calls?
 
J

Jay Freedman

The Word VBA Help shows the syntax in the required order. For example:

expression.AddOLEObject(ClassType, FileName, LinkToFile, DisplayAsIcon,
IconFileName, IconIndex, IconLabel, Range)

where "expression" is an expression that returns an InlineShapes object.

You can copy/paste that syntax into the LotusScript editor and then replace
the parameters with your values/variables.

If the VBA editor and its help aren't handy but you have Internet access,
the help is online. For example, for Word 2003 you need the Word VBA
reference
http://msdn2.microsoft.com/en-us/library/aa272078(office.11).aspx and the
Office VBA reference
http://msdn2.microsoft.com/en-us/library/aa271312(office.11).aspx.

As another way, if you type the first part of the statement into the VBA
editor

Selection.InlineShapes.AddOLEObject

you can get an IntelliSense tag with the parameters in the correct order by
typing a space or left parenthesis after the keyword, or by clicking Edit >
Parameter Info (shortcut = Ctrl+Shift+I). Unfortunately, there's no way to
copy that to the clipboard.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top