OLE Automation with Word 7

All my users and fellow developers are on Word  v7.0a (which does not
work)
and only I happen to have 7.0 (which works).  I've tried background
printing on and off in Word. The routine loops through multiple records
as shown beloew.

The first run through is fine.  It fails on the second record at the
FileOpen/FileNew.
I tried adding wait loops of 10 seconds (!) after the fileprint and the
fileclose - to no avail.  The error is "Error calling external object
function
fileopen...".  I tried upgrading to the latest PB5.0.04 maint release -
still
no dice.

Does Powerbuilder support OLE at all ?? It was PB tech support who told
me to
use OLE in the first place since the RTF doesn't work as advertise (try
adding
a bitmap of a signature to the datawindow).

OLEObject merge_doc
integer  i, j
string   ls_insert, ls_col_type
long   RetVal


merge_doc = CREATE oleObject

RetVal = merge_doc.ConnectToNewObject("word.basic")

For i = 1 to arg_dw.RowCount()

// Also seperately tried FileOpen with a document.
 merge_doc.FileNew(arg_file)

 For j = 1 to (UpperBound(arg_fields) -1) STEP 2
  merge_doc.editgoto(arg_fields[j])


  If IsNull(ls_insert) Then
   ls_insert = " "
  End If
  merge_doc.insert(ls_insert)
 Next

 merge_doc.fileprint()

 merge_doc.fileclose(2)


Next

// This was added because without it the last fileprint()
// does not get printed. Sometimes it is left in the print spool.
Yield()

merge_doc.DisconnectObject()
DESTROY merge_doc


Return 1


0
Steve
2/19/1998 10:16:26 PM
sybase.ole-ocx-activex 6324 articles. 0 followers. Follow

1 Replies
532 Views

Similar Articles

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

Steve -- 

I'm not sure, but I believe if you change your fileprint command to
merge_doc.fileprint(0), the documents will print in the foreground
instead of the background.  That way, you won't be able to close word
until after the document completes printing.

HTH

Ron Gallagher, CPDP
Atlanta, GA, USA
rongallagher@mindspring.com

Steve Gutterman wrote:
> 
> All my users and fellow developers are on Word  v7.0a (which does not
> work)
> and only I happen to have 7.0 (which works).  I've tried background
> printing on and off in Word. The routine loops through multiple records
> as shown beloew.
> 
> The first run through is fine.  It fails on the second record at the
> FileOpen/FileNew.
> I tried adding wait loops of 10 seconds (!) after the fileprint and the
> fileclose - to no avail.  The error is "Error calling external object
> function
> fileopen...".  I tried upgrading to the latest PB5.0.04 maint release -
> still
> no dice.
> 
> Does Powerbuilder support OLE at all ?? It was PB tech support who told
> me to
> use OLE in the first place since the RTF doesn't work as advertise (try
> adding
> a bitmap of a signature to the datawindow).
> 
> OLEObject merge_doc
> integer  i, j
> string   ls_insert, ls_col_type
> long   RetVal
> 
> merge_doc = CREATE oleObject
> 
> RetVal = merge_doc.ConnectToNewObject("word.basic")
> 
> For i = 1 to arg_dw.RowCount()
> 
> // Also seperately tried FileOpen with a document.
>  merge_doc.FileNew(arg_file)
> 
>  For j = 1 to (UpperBound(arg_fields) -1) STEP 2
>   merge_doc.editgoto(arg_fields[j])
> 
>   If IsNull(ls_insert) Then
>    ls_insert = " "
>   End If
>   merge_doc.insert(ls_insert)
>  Next
> 
>  merge_doc.fileprint()
> 
>  merge_doc.fileclose(2)
> 
> Next
> 
> // This was added because without it the last fileprint()
> // does not get printed. Sometimes it is left in the print spool.
> Yield()
> 
> merge_doc.DisconnectObject()
> DESTROY merge_doc
> 
> Return 1
0
Ron
2/20/1998 4:07:24 PM
Reply:

Similar Artilces:

OLE Automation to Word 7 for Mail Merge...
I am trying to use OLE Automation out to Word for Windows 95 Version 7.0 from PB 6.5 (build 444) to do a mail merge. My problem is that I and am getting a null reference on my OLEObject variable. The ConnectToNewObject statement works with a 0 return code, but then the very next reference to lole_msword gives me a null reference! I have tried adding Object to the dot notation. eg. lole_msword.Object.Activate(InPlace!) - does not help. I have tried the examples in Chapter 19, Using OLE in an Application in the App Techniques manual but don't get anywhere. Any help would be...

Ole to Word 95 (Word 7)
I am trying to get Word to retrieve a document and come into focus. The ConnectToObject is working fine. The retrieve is working fine. The only problem that I am having is getting Word to pop-up if it is currently minimized. If it is not minimized, a AppActivate() command works fine. I have tried AppMaximize(),AppShow() and AppRestore(). If Word is minimized, none of these work. Anyone have any ideas ?? Kevin Wydra kwydra@magicnet.net I use API functions like Showwindow() Kevin Wydra wrote: > I am trying to get Word to retrieve a document and come into focu...

WORD OLE automation
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 = ...

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 ...

Word OLE automation
I am about to embark on a PB 5.0 project that will require dynamic creation of documents for use with Word 97's mail merge capability. Being that this is my first time using OLE, as well as my first time programming Word, could anybody point me in the right direction (books, articles, web sites, etc.) to get me started? I've experimented a little with what I could find on Microsoft's and Sybase's sites, but I am looking for something more comprehensive. =============== Daniel Buki Software Developer Butte County (CA) Migrant Education cerkit@ncal.net In article...

Word OLE automation
Would like to open word document using OLE after populating word using OLE Automation. The document should open up in print preview mode,and then using either VBA, or other code print or close from print preview. I want to supress all menus and commandbars from the word document. What code can i run from PB script to open in print preview and turn off menus and command bars, and put in two of my own command buttons. ...

MS-Word & Powerpoint automation, using OLE automation [Edit]
Hello, Here is what I need to do, from my Delphi application : starting from a MS-Word document, create a PPT presentation simply made of a series of embedded MS-Word objects. There would be 1 slide for each page of the source document (assuming same page size & orientation on both sides). This requires to control both a WordApplication and a PowerpointApplication in parallel, and proceed basically as follows : - in Word, open the source file - In Powerpoint, create a new presentation - For each page of the Word doc, |- in Word, select from start to end of current page, then &quo...

OLE Automation memory leak in PB 7 w/SQL Server 7
I am experiencing a severe memory leak while using OLE Automation in PB 7.0.1 (7023), MS Word 2000 and SQL Server 7 (SP1). I have made sure all OLEObjects CREATEd are DESTROYed at the end of my scripts, yet the problem still exists. I have also experimented with different DBParm entries. Same result. Anyone experience the same or have a possible solution? Thanks, Robert Wren, Jr. ...

Word 6 OLE automation
Hi, I'm using OLE automation with Word 6 to perform a mail merge. Most of the methods work OK (FileOpen, FilePrint etc.) but some of them don't (FileClose). PB says : Error calling external object function blablabla ... The function's name is OK, and the parameters also. I've debugged the externalexception event, and the OLE server tells me that I've tried to handle an element like a function when it isn't. The bizarre thing is that, calling a macro with that instruction (FileClose) works. Perhaps the solution is putting all the code in the macro ? ...

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...

Word Automation through Win32::OLE
Long time lurker, first time poster...please be gentle. I am attempting to move through a directory, pull out only files of a ..fin extension (which is Word document format), save each one as .rtf (Rich Text Format). I'd also like to be able to run some predefined macros on the files, but I thought just being able to save was a good place to start. Currently I get an error stating 'Can't call method "SaveAs" on an undefined value'. If someone could point me to some clearer text on Win32::OLE than the stuff that ASPN, CPAN and Oreilly's Win32 o...

OLE automation with word 97
Dear Sir /Madam I like to ask about how to use the oleobject with Word 97, On word 95 and its predecessor, its clear to use "word.basic" but the speed is very slow compare with other OLE connectivity, So I try with word 97, but the format and function of word 97 is very different from the previous ones, they use VBA (for visual Basic Command), So I like to ask if to use OLE with word97 to connect and merge letter with data supplied by PowerBuilder, like code below, what is the corresponding code in word 97?, or Does PowerBuilder 5.0 does not support Word 97 or vice-versa. ...

Web resources about - OLE Automation with Word 7 - 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 ...

Meet Microbot Push, a home automation gadget lazy people will love
A South Korean startup called Naran has come up with an incredibly clever way for users to control and automate any type of switch-oriented task ...

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 ...

Resources last updated: 11/24/2015 5:03:24 PM