WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Word

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

OLE with WordBasic and Inserting a Null Value

Keywords:    OLE null

Question:

I'm having a problem with OLE between Winbatch and Microsoft Word. You basically use the WordBasic macro lang when invoking methods via OLE. For example,
        WordObj = ObjectOpen("Word.Basic")
        WordObj.FileOpen("c:\a.doc")
This simply opens up a document within Word. However, the FileOpen macro/method contains many other parameters (in additon to the file to open). Sometimes I wish for one of these parameters to be NULL. I can't seem to get past this problem. For example, this doesn't seem to work:
        WordObj.FileOpen("c:\a.doc", 1, 1, 1, , , 0)
I get the error "Type mismatch".

The problem seems to be with the null parameters. This doesn't work either:

	WordObj.FileOpen("c:\a.doc", 1, 1, 1, "", "", 0)
I can't seem to pass a null value via OLE to a Wordbasic macro/method.

What am I missing? I can't find a syntax that works.

Answer:

You could try just stuffing a 0 in there and hope it work. It if it does not, try...
	mynull=BinaryAlloc(10)
	BinaryPoke(mynull,0,0)
and use the mynull variable where you need a null in the parameter string.
Article ID:   W13671
Filename:   OLE and Word Basic.txt
File Created: 1999:04:15:16:55:36
Last Updated: 1999:04:15:16:55:36