Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP and WORD
Message
 
To
18/12/1997 16:04:18
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00066799
Message ID:
00067282
Views:
25
I have no idea...it is a VFP error though...and it craps right out...the session on WordPerfect keeps going....

Joe

>Yeah, it's wordbasic. I was just explaining what Evan was referring to. It doesn't apply to Juan's problem.
>Joseph-
>That's strange that the code you gave crashes VFP. I have never had to use the = in 5.0. Following is a snip from the first code I ever wrote to automate word. It has been live for many months, and never had a crash:
>
>Wait window "Printing..." nowait
>wrd = CREATEOBJECT("WORD.BASIC")
>wrd.filenew
>wrd.toolsoptionsprint(,,,,,,,,,,,0,,,) && Turns off background printing in word
>wrd.ToolsCreateEnvelope(,,,,,,, envaddress,,,barcode ,,,, 1) && Sends address string and prints
>wrd.toolsoptionsprint(,,,,,,,,,,,1,,,) && Turns background printing back on
>wrd.fileexit
>wait clear
>
>
>>isn't this word basic and not vba?
>>>>>>>oleobj = createobject("word.basic")
>>
>>anyway,this works for me.
>>try it from the command window and check and make sure type( "oleobj" ) = "O" and isnull( oleobj ) != .f.
>>
>>
>>>He is using Word 7.0. The problem with Word97 was that certain VBA commands generated OLE errors when issued from VFP. I think that file.exit was one of them. The way around it is to just use wordbasic instead of VBA. Contrary to what seems like a popular belief, wordbasic works fine with Word97.
>>>
>>>Juan,
>>> after you instanciate word, have you tested to see if the createobject was successful?
>>>Does oleobj.show generate the same error?
>>>
>>> >What version of Word are you using? I vaguely recall an earlier thread where someone pointed out that there was a bug or problem using Word97. If this is the case and you have access to an earlier version of Word, try your code there.
>>>>
>>>>I'm sure you already know, but I'll confirm the fact that there is nothing wrong with your syntax. I cut and pasted each line from your message into VFP 5 and had no problem.
>>>>
>>>>>the '=' is no longer necessary in VFP 5.0
>>>>>
>>>>>
>>>>>>Try using
>>>>>>
>>>>>>=oleobj.filenew()
>>>>>>
>>>>>>The important part is the equal sign.
>>>>>>
>>>>>>Joe
>>>>>>
>>>>>>>Hi
>>>>>>>
>>>>>>>
>>>>>>>I am executing some OLE statements in order to produce a Word
>>>>>>>Document from VFP 5.0 Prof.
>>>>>>>
>>>>>>>Word version is 7.0 (Office 95) + Windows 95.
>>>>>>>
>>>>>>>Statements are like this:
>>>>>>>
>>>>>>>oleobj = createobject("word.basic")
>>>>>>>
>>>>>>>oleobj.filenew
>>>>>>>
>>>>>>>oleobj.insert("Any Text" + table.field)
>>>>>>>
>>>>>>>oleobj.fileclose
>>>>>>>
>>>>>>>oleobj.filequit
>>>>>>>
>>>>>>>etc.
>>>>>>>
>>>>>>>
>>>>>>>Any statement after "createobject" generates this error message:
>>>>>>>
>>>>>>>OLE Error 0x80020006 (Error Number 1426).
>>>>>>>
>>>>>>>Please, Does anyone know about this? What is the problem?
>>>>>>>
>>>>>>>Thanks
>>>>>>>
>>>>>>>Juan Carlos
Joseph C. Kempel
Systems Analyst/Programmer
JNC
Previous
Reply
Map
View

Click here to load this message in the networking platform