Re: ole2 and Forms
Date: Thu, 06 May 1999 02:59:00 GMT
Message-ID: <7gr0hk$r92$1_at_nnrp1.deja.com>
Hi Kasia,
You'll need to take a look in Word's help file which will tell you the arguments you need to pass when calling a particular command, e.g., Word97's SaveAs command takes 11 arguments which are FileName, FileFormat, LockComments, etc.
I think the reason why your code isn't working is because you're adding a literal string 'wdFormatDocument' to your argument list when you should be adding the value of Word97's wdFormatDocument constant. To find out the value of this constant just write a simple macro in Word to display the constant's value in a message box. e.g., running the following Word97 macro:
Sub ShowConstantValue()
MsgBox wdFormatDocument
End Sub
Will tell you that wdFormatDocument has a value of zero. Therefore, your code should look like this:
arglist := ole2.CREATE_ARGLIST;
ole2.ADD_ARG(arglist, 'C:\Kasia\Tests\truc.doc'); --FileName ole2.ADD_ARG(arglist, 0); --FileFormat ole2.INVOKE(document,'SaveAs',arglist); ole2.DESTROY_ARGLIST(arglist);
That should work!
Neil W. Garside (Brisbane, Australia)
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu May 06 1999 - 04:59:00 CEST