WORD OLE automation - WORD 97 does not work/ WORD 6 OK


The following code works perfectly with WORD6/Windows95/PB6, but does
not work for WORD 97/NT.

OLEObject      lole_word
string                ls_mytext = "Trial text"

li_rc = lole_word = CREATE OLEObject

li_rc = lole_word.ConnectToNewObject("word.basic")                // in
NT WORD is opened INVISIBLY

// It appears as a process in the Task Manager

// li_rc = 0

li_rc = lole_word.FileNew("normal",
0)                                        // Returns li_rc = NULL
li_rc =
lole_word.Insert(ls_mytext)
// Not recognised by WORD97

li_rc =
lole_word.DisconnectObject()                                          //
li_rc = 0 BUT the process is not removed!!

DESTROY     lole_word

Please add any reply to my e-mail as well
Avron Polakow
avron@shira.com


0
avron
5/27/1998 9:46:27 AM
sybase.ole-ocx-activex 6324 articles. 0 followers. Follow

4 Replies
1249 Views

Similar Articles

[PageSpeed] 32
Get it on Google Play
Get it on Apple App Store

IN WORD 97 the WordBasic programming language has been replaced by the
Visual Basic for Applications language (VBA). That's why .FileNew and
.Insert
commands are not recognized. You have to find VBA equivalents for WordBasic
commands you were using for WORD 6. 
 
avron polakow <avron@shira.com> wrote in article
<356BE0F2.CEE7BEB0@shira.com>...
> 
> 
> The following code works perfectly with WORD6/Windows95/PB6, but does
> not work for WORD 97/NT.
> 
> OLEObject      lole_word
> string                ls_mytext = "Trial text"
> 
> li_rc = lole_word = CREATE OLEObject
> 
> li_rc = lole_word.ConnectToNewObject("word.basic")                // in
> NT WORD is opened INVISIBLY
> 
> // It appears as a process in the Task Manager
> 
> // li_rc = 0
> 
> li_rc = lole_word.FileNew("normal",
> 0)                                        // Returns li_rc = NULL
> li_rc =
> lole_word.Insert(ls_mytext)
> // Not recognised by WORD97
> 
> li_rc =
> lole_word.DisconnectObject()                                          //
> li_rc = 0 BUT the process is not removed!!
> 
> DESTROY     lole_word
> 
> Please add any reply to my e-mail as well
> Avron Polakow
> avron@shira.com
> 
> 
> 
0
Irina
5/27/1998 4:04:32 PM
<HTML>
Still no luck.

<P>I think that you are right and that the reason seems to be the move
to VBA.
<BR>Rob Raymond suggested the same reason to me but when I tried VBA it
doesn't seem to work.
<BR>(see the VBA code I tried below.)

<P>I get the error: Powerbuilder Application Executution Error (R1038)
<BR>"Error: name not found accessing external object property documents...."

<P>What commands should be used?

<P>At the Microsoft SDK site they give a VB example, where they use the
<BR>statement: lole_word.AppShow.

<P>As far as I know PB cannot use statements but using this as a
<BR>function:&nbsp; lole_word.AppShow()
<BR>makes no difference and the same error occurs.

<P>So much for Microsoft backward compatibility.
<BR>Is it possible that PB is no longer is compatible with WORD OLE?

<P>(I have numerous COMs that we have written here and there hasn't been
any
<BR>problem with any of them.)

<P>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<BR>// This doesn't work either
<BR>//////////////////////////////////////
<BR>>OLEObject lole_word, lole_doc, lole_sel
<BR>>
<BR>>li_rc = lole_word.ConnectToNewObject("Word.Application")
<BR>>lole_doc = lole_word.Documents.Add("normal")
<BR>>lole_doc.Select()
<BR>>lole_sel = lole_doc.Selection
<BR>>lole_sel.InsertAfter(ls_mytext)
<BR>>
<BR>>// diconnect all of the OLEObject, else app stays "alive"
<BR>>lole_sel.DisconnectObject()
<BR>>lole_doc.DisconnectObject()
<BR>>lole_word.DisconnectObject()
<BR>>
<BR>>DESTROY lole_word
<BR>>

<P>Irina Kudryavtsev wrote:
<BLOCKQUOTE TYPE=CITE>IN WORD 97 the WordBasic programming language has
been replaced by the
<BR>Visual Basic for Applications language (VBA). That's why .FileNew and
<BR>Insert
<BR>commands are not recognized. You have to find VBA equivalents for WordBasic
<BR>commands you were using for WORD 6.

<P>avron polakow &lt;avron@shira.com> wrote in article
<BR>&lt;356BE0F2.CEE7BEB0@shira.com>...
<BR>>
<BR>>
<BR>> The following code works perfectly with WORD6/Windows95/PB6, but
does
<BR>> not work for WORD 97/NT.
<BR>>
<BR>> OLEObject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lole_word
<BR>> string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ls_mytext = "Trial text"
<BR>>
<BR>> li_rc = lole_word = CREATE OLEObject
<BR>>
<BR>> li_rc = lole_word.ConnectToNewObject("word.basic")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// in
<BR>> NT WORD is opened INVISIBLY
<BR>>
<BR>> // It appears as a process in the Task Manager
<BR>>
<BR>> // li_rc = 0
<BR>>
<BR>> li_rc = lole_word.FileNew("normal",
<BR>> 0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// Returns li_rc = NULL
<BR>> li_rc =
<BR>> lole_word.Insert(ls_mytext)
<BR>> // Not recognised by WORD97
<BR>>
<BR>> li_rc =
<BR>> lole_word.DisconnectObject()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//
<BR>> li_rc = 0 BUT the process is not removed!!
<BR>>
<BR>> DESTROY&nbsp;&nbsp;&nbsp;&nbsp; lole_word
<BR>>
<BR>> Please add any reply to my e-mail as well
<BR>> Avron Polakow
<BR>> avron@shira.com
<BR>>
<BR>>
<BR>></BLOCKQUOTE>
&nbsp;</HTML>

0
avron
5/28/1998 10:33:30 AM
I've noticed your code is a little off (please don't take offense, I'm only
trying to help...  and if it is not incorrect, my apologies).  Anyway, it
looks like you are trying to assign each of your function calls to an
oleobject.  All you need to do is assign one variable to type oleobject and
use 'connecttonewobject' with it.  After that, you just use the instantiated
oleobject variable to reference functions within the OLE server (which will
be MS Word when you connect).  Once you are complete, disconnect and destroy
your object.  Try this little snipet...  It may have some things that may
help you.

OleObject iole_word
STRING ls_name, ls_address, ls_city, ls_state, ls_zip
STRING ls_doc

// Note#1: assign values to above (through db, hardcode, sle's)
// Note#2: ls_doc must have the bookmarks listed below in it

iole_word = CREATE OleObject

IF iole_word.ConnectToNewObject('word.application.8') = 0 THEN
   iole_word.Documents.Open(ls_doc)
ELSE
   MessageBox('Word OLE','Unable to connect to MS Word.')
END IF

iole_word.Visible=True // Change to 'False' if you don't want Word visible

iole_word.Selection.Goto(True,0,0,'bookmark_name')
iole_word.Selection.Typetext(ls_name)

iole_word.Selection.Goto(True,0,0,'bookmark_address')
iole_word.Selection.Typetext(ls_address)

iole_word.Selection.Goto(True,0,0,'bookmark_city')
iole_word.Selection.Typetext(ls_city)

iole_word.Selection.Goto(True,0,0,'bookmark_state')
iole_word.Selection.Typetext(ls_state)

iole_word.Selection.Goto(True,0,0,'bookmark_zip')
iole_word.Selection.Typetext(ls_zip)

iole_word.ActiveDocument.Save()
iole_word.ActiveDocument.Close()
iole_word.Application.Quit()
iole_word.DisconnectObject()
DESTROY iole_word

Hope this helps.
Tom
    avron polakow wrote in message <356D3D7A.1EA75F66@shira.com>...
    Still no luck.
    I think that you are right and that the reason seems to be the move to
VBA.
    Rob Raymond suggested the same reason to me but when I tried VBA it
doesn't seem to work.
    (see the VBA code I tried below.)

    I get the error: Powerbuilder Application Executution Error (R1038)
    "Error: name not found accessing external object property documents...."

    What commands should be used?

    At the Microsoft SDK site they give a VB example, where they use the
    statement: lole_word.AppShow.

    As far as I know PB cannot use statements but using this as a
    function:  lole_word.AppShow()
    makes no difference and the same error occurs.

    So much for Microsoft backward compatibility.
    Is it possible that PB is no longer is compatible with WORD OLE?

    (I have numerous COMs that we have written here and there hasn't been
any
    problem with any of them.)


////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
    // This doesn't work either
    //////////////////////////////////////
    >OLEObject lole_word, lole_doc, lole_sel
    >
    >li_rc = lole_word.ConnectToNewObject("Word.Application")
    >lole_doc = lole_word.Documents.Add("normal")
    >lole_doc.Select()
    >lole_sel = lole_doc.Selection
    >lole_sel.InsertAfter(ls_mytext)
    >
    >// diconnect all of the OLEObject, else app stays "alive"
    >lole_sel.DisconnectObject()
    >lole_doc.DisconnectObject()
    >lole_word.DisconnectObject()
    >
    >DESTROY lole_word
    >

    Irina Kudryavtsev wrote:

        IN WORD 97 the WordBasic programming language has been replaced by
the
        Visual Basic for Applications language (VBA). That's why .FileNew
and
        Insert
        commands are not recognized. You have to find VBA equivalents for
WordBasic
        commands you were using for WORD 6.
        avron polakow <avron@shira.com> wrote in article
        <356BE0F2.CEE7BEB0@shira.com>...
        >
        >
        > The following code works perfectly with WORD6/Windows95/PB6, but
does
        > not work for WORD 97/NT.
        >
        > OLEObject      lole_word
        > string                ls_mytext = "Trial text"
        >
        > li_rc = lole_word = CREATE OLEObject
        >
        > li_rc = lole_word.ConnectToNewObject("word.basic")
// in
        > NT WORD is opened INVISIBLY
        >
        > // It appears as a process in the Task Manager
        >
        > // li_rc = 0
        >
        > li_rc = lole_word.FileNew("normal",
        > 0)                                        // Returns li_rc = NULL
        > li_rc =
        > lole_word.Insert(ls_mytext)
        > // Not recognised by WORD97
        >
        > li_rc =
        > lole_word.DisconnectObject()
//
        > li_rc = 0 BUT the process is not removed!!
        >
        > DESTROY     lole_word
        >
        > Please add any reply to my e-mail as well
        > Avron Polakow
        > avron@shira.com
        >
        >
        >




0
Tom
5/28/1998 6:25:52 PM
The code will be :

OLEObject      lole_word
string                ls_mytext = "Trial text"

li_rc = lole_word = CREATE OLEObject

li_rc = lole_word.ConnectToNewObject("word.application.8")               
// in
NT WORD is opened INVISIBLY

// It appears as a process in the Task Manager

// li_rc = 0


li_rc = lole_word.applications.FileNew("normal",
0)                                        // Returns li_rc = NULL
li_rc =
lole_word.applications.Insert(ls_mytext)
// Not recognised by WORD97

li_rc =
lole_word.DisconnectObject()                                          //
li_rc = 0 BUT the process is not removed!!

DESTROY     lole_word



avron polakow <avron@shira.com> wrote in article
<356BE0F2.CEE7BEB0@shira.com>...
> 
> 
> The following code works perfectly with WORD6/Windows95/PB6, but does
> not work for WORD 97/NT.
> 
> OLEObject      lole_word
> string                ls_mytext = "Trial text"
> 
> li_rc = lole_word = CREATE OLEObject
> 
> li_rc = lole_word.ConnectToNewObject("word.basic")                // in
> NT WORD is opened INVISIBLY
> 
> // It appears as a process in the Task Manager
> 
> // li_rc = 0
> 
> li_rc = lole_word.FileNew("normal",
> 0)                                        // Returns li_rc = NULL
> li_rc =
> lole_word.Insert(ls_mytext)
> // Not recognised by WORD97
> 
> li_rc =
> lole_word.DisconnectObject()                                          //
> li_rc = 0 BUT the process is not removed!!
> 
> DESTROY     lole_word
> 
> Please add any reply to my e-mail as well
> Avron Polakow
> avron@shira.com
> 
> 
> 
0
sanjeev
6/17/1998 7:22:04 PM
Reply:

Similar Artilces:

problems using OLE Automation and ActiveX in PB 6
We are writing a PowerBuilder application that can be used as OLE Runtime Automation Server. We are using PowerBuilder 6.0 beta 3. We've built a 32-bit .pbd and made it a DLL ( OLE server ) We've used PowerBuilder sample program PBGENREG.PBL to generate .reg and .tlb (type library) files. We've installed PowerBuilder deployment on Windows NT 4.0 server and tried to register it with the system using "regsvr32.exe" program. We are getting an eror message: "C:\MyOLEServer.dll was loaded, but the DllRegisterServer entry point was not found. DllRegisterS...

can i use pb's automation server to create an activex/ole/ocx? help me!
Please do not cross-post. -- <hopethishelps/> Roy Kiesler [TeamSybase] MySybase -- http://www.sybase.com/mysybase "tadsun" <tadsun@163.com> wrote in message news:UXo0Ru7BCHA.201@forums.sybase.com... > > > ...

WordPerfect: OLE automation through OLE control
OK, I connected to WordPerfect from PB6.5 by using OLEObject like: OLEObject ole_obj ole_obj= CREATE OLEobject li_rc=ole_obj.ConnectToNewObject ("WordPerfect.PerfectScript") ........ Now it accepts automation commands. But my goal is to start OLE automation through Object property of OLE control. Something like: ole_1.Activate(Offsite!) ole_obj=ole_1.Object.WordPerfect.PerfectScript ..... And that does not work though it does with Word. Does somebody know if it is possible at all to make OLE automation through OLE control and how to do that? Thanks ...

OLE Automation #6
Hi ya'll. I need to call a function in EXCEL from my PB app. Is this doable? Thanks. Cool What type of function? You can use the VB Editor by pressing ALT+F11 to find out the syntax. HTH, Austin "Cool Weather" <aldenix@hotmail.com> wrote in message news:454b8778$1@forums-1-dub... > Hi ya'll. > > I need to call a function in EXCEL from my PB app. Is this doable? Thanks. > > Cool > NORMSDIST() thanks. "Austin Phillips" <aphillips_at_aticousa_dot_com> wrote in message news:454f941c$1@forums-1-d...

Work with Excel Ole Automation
Hi, i need to work with very complex format excel files. I got to send and get data form excel files and those data can be in cell with different formats, even data that expan more than 2 cells. I wonder if anyone knows any site where i can take a look to Ole Automation Excel's API (methods) otherwise any software that can modify data in files like that. Thanks in advance. Regards. Please don't crosspost. I've responded in another forum. -- Terry Dykstra (TeamSybase) http://powerbuilder.codeXchange.sybase.com/ http://casexpress.sybase.com product enhancement requ...

OLE Word97 and ole objects vs ole controls
--------------50D299EA9D99A20C83E801AB Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I am new to OLE automation. I'm trying to connect to a word97 document and filling forms fields with information. I'm trying to use the following code. I'm getting the following error in my log file: DateTime: 10/27/99 18:32:07 Title: System Error Message: Error Number 36. Error text = Name not found accessing external object property object. Window/Menu/Object = w_ole_test. Error Object/Control = cb_okay. Script = clicked. Line in Script = 22. ...

OLE Word97 and ole objects vs ole controls
--------------50D299EA9D99A20C83E801AB Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I am new to OLE automation. I'm trying to connect to a word97 document and filling forms fields with information. I'm trying to use the following code. I'm getting the following error in my log file: DateTime: 10/27/99 18:32:07 Title: System Error Message: Error Number 36. Error text = Name not found accessing external object property object. Window/Menu/Object = w_ole_test. Error Object/Control = cb_okay. Script = clicked. Line in Script = 22. ...

ActiveX, OLE Automation, OLEStorage
1.) Does anyone know how to create an ActiveX control in PB 6.0 or 6.5? 2.) I have utilized OLE automation to use some functionality of Excel and Word. Unfortunately, whenever I use the ConnectToNewObject() or ConnectToObject() functions of an OLEObject variable, either the entire application of Word or Excel application is opened behind the scenes. This is the case even though I only want to use a single function within these applications. It seems like a waste to load the entire application to get just at simple functionality. Is it possible to open lightweight component applicatio...

Why does OLE Control work but OLE Object doesn't ?
I am trying to deploy a third party ActiveX/OCX in a PowerBuilder NVO (for EAServer). Placing an OLE Control on a window works fine. I can access object properties etc. Using an OLEObject and ConnectToNewObject should accomplish the same result (as per PB documentation) These two code segments should work identically, but the second (which I need to work) produces "Error accessing external object property" error // 1. OLE control placed on a window ole_1.Object.Timeout = 1000 // 2. ActiveX control placed on a window OLEObject ole_obj ole_obj = CREATE OLEObj...

6.5 bug; OLE Automation
Well, I just downloaded the 6.5 release, and installed it. In my first test, I detected an OLE Automation error... resulting in a fatal exception (both IDE and EXE). And I thought this release was going to be a stable one. ;( Exception is at address 0x10c7e524 of pb60.exe, address 0x00008006 could not be read. I have a small PB OLE server, which is a single NVO. 1) I regenerated the OLE client. 2) Regened and recreated the PBD for the OLE Server 3) ran OLEGENREG just in case something was added to the OLE server registration same FE whether in IDE or EXE. Seems things...

ActiveX Controls, OLE Automation, OLEStorage
1.) Does anyone know how to create an ActiveX control in PB 6.0 or 6.5? 2.) I have utilized OLE automation to use some functionality of Excel and Word. Unfortunately, whenever I use the ConnectToNewObject() or ConnectToObject() functions of an OLEObject variable, either the entire application of Word or Excel application is opened behind the scenes. This is the case even though I only want to use a single function within these applications. It seems like a waste to load the entire application to get just at simple functionality. Is it possible to open lightweight component applicatio...

Welcome to the OLE-OCX-ACTIVEX newsgroup
Welcome to the OLE-OCX-ACTIVEX newsgroup. This is a forum for discussion on topics related to the usage of OLE, OCX and ACTIVEX with PowerBuilder. Feel free to post questions about the product, concerns about your development needs for enhancements and any other feedback. All posted messages will be in the public domain and may be republished on Powersoft's InfoBase CD ROM as well as on our WebSite in order to provide information that is extremely valuable to other developers. This is NOT Powersoft Technical Support and it is not the purpose of this newsgroup service to allo...

PCCharge OLE and PB 6.51 not working
There is an OLE from PCCharge for embedding credit card transactions. I can not get the OLE to load properly in PowerBuilder. I CAN get the OLE to load in VB6 without a problem. I can also see the ActiveCharge OLE and all the properties and methods in the OLE section of the browser. Everytime I run the program it gives me an error at the ConnectToObject line. Any help with this would be appreciated. Here is a code snippet of what I have tried: OLEobject Active_Charge r=Active_Charge = CREATE oleobject t=Active_Charge.ConnectToObject = "ActiveCharge.PccCharge" ...

OLE Automation using dll in PB8 is not working
This is what I did in PB 6.5.1 and it worked: I created a customclass NVO and wrote a function with following signature boolean process_sms(string, ref string) Code boolean process_sms(string s_input , ref string s_output) s_input = 'My Message : ' + s_output return true I then created a dll via project painter. Then registered the object thru OLE automation wizard. Another PB code which connects to this OLE dll using ConnectToNewObject(ProgID) connects and works fine. But when I try to do the same using PB8.0.2 Build 9506 it does not connect and generates pb80.ex...

OLE Automation to Excel 97 Memory Leaks
I communicate to Excel via OLE Automation with the following code and on a very large run (looping 130 times to fill in an Excel worksheet and print each one) the PC runs out of memory. Is this a problem in my code? Is this a Powerbuilder problem? Or, is this an OLE - Excel problem? Does anyone know what the problem is here? Does anyone know how to fix this problem? //Allocate memory for the OLEObject variable iole_obj = CREATE n_oo //oleObject //Attempts to connect to a running Excel OLE server or attempts to connect and start //the Excel OLE server IF wf_connec...

Web resources about - WORD OLE automation - WORD 97 does not work/ WORD 6 OK - sybase.ole-ocx-activex

Automation - Wikipedia, the free encyclopedia
For a hierarchical presentation of automation topics, see Outline of automation . For other uses, see Automation (disambiguation) . Automation ...

Automation World - Covering the field of industrial automation
AutomationWorld.com delivers content for the Automation Buying team, which includes Information Technology and Networking; Operations and Engineering; ...

Facebook Ads API Partner AdStage: Campaign Automation, $6.25M Series A Funding
AdStage , a Facebook ads API partner, announced Wednesday the launch of campaign automation — as well as a $6.25 million round of Series A funding. ...

Facebook PMD IgnitionOne launches self-service marketing automation
IgnitionOne , a Facebook Preferred Marketing Developer, announced Tuesday the launch of the Marketing Automation tool. A fully integrated module ...

Automation Heroes (@automationhero) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Automation World
Automation World is your link to the why and how of manufacturing automation. The purpose of this group is to connect manufacturing engineers,... ...

Young people don't consider automation issues when choosing a career
... launched a new research study that determines that almost half (49 percent) of young people in Britain are not taking the issue of job automation ...

Robots Will Change World Beyond Recognition Says BoA; Automation Will Change Jobs More Than Kill Them ...
Robot Theory The battle of robot theory is on. Bank of America paints one picture and McKinsey another. Let's investigate both theories. Automation ...

Rockwell Automation Announces Mobility Co-Innovation with Microsoft
A new mobility co-innovation project by Rockwell Automation and Microsoft Corp. will be demonstrated at Automation Fair in Chicago Nov. 18 and ...

3 Growing Digital Trends for 2016: Automation, Personalization, Gamification.
1. Marketing Automation What is it? Marketing automation is a category of technology that allows companies to streamline, automate, and measure ...

Resources last updated: 12/15/2015 8:28:08 PM