Integrating WordPerfect and VB6

Posted on 2002-05-08
Last Modified: 2008-02-01
I'm using VB 6 and I need to open and save a Word Perfect document.  I also need to do this with the withevents keyword so that I can determine when the document has been closed.

I know how to do this without using the withevents but whenever I use that keyword things will not work anymore.  

Does anyone have any sample code that shows how to open and save a file with the withevents keyword so that I know when the file closes..



Question by:jtjcomp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
LVL 16

Expert Comment

ID: 6997019
Which program do you use to save the files, wordperfect?
The WithEvents statement only works if object supports events.
For intance, Word support events so if you use:
dim withevents wdapp as word.application
it will returns event to your app, but if you use (following same example):
dim withevents cmdbar as commandbarbutton
it doesn't works since commandbarbutton objects doesn't expose them.
Further details will be nice.

Author Comment

ID: 6997132
I'm using the Wordperfect class.  When i dim it withevents i have to choose between wordperfect.globalmacros or wordperfect.document.

When I dont use withevents I get two more choices perfectscript and application.

If i dont use withevents I can do the file open and save fine, The following code does that

'        Set WPApp = New WordPerfect.PerfectScript
'        Set WPApp = CreateObject("WordPerfect.perfectscript")
'        WPApp.AppMaximize
'        WPApp.FileOpen strDocLocation & strDocument

Since I want to use the withevents I'm forced to use wordperfect.document instead of wordperfect.perfectscript.  I dont know how to use wordperfect.document to open or save a file.
LVL 16

Expert Comment

ID: 6997171
Unfortunatelly, i don't have that class but it appears like it doesn't expose events that you need.
When you try create it withevents...
is it available in code window, objects combo box?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 6998051

Expert Comment

ID: 6998053
An article on this also



Author Comment

ID: 6998757
The code looks good, but he is not monitoring when the document exits hence the withevents.

Is this impossible to do in VB?

LVL 16

Accepted Solution

Richie_Simonetti earned 100 total points
ID: 6998833
Not only from VB but every language that supports COM.
As i told you, if class doesn't expose those events, you cannot access it.
LVL 16

Expert Comment

ID: 7065028
"The code looks good..."
Then, why did you accept my comment as answer?

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vb6 connector to SQL Server 2 42
TT Auto Dashboard 13 104
Child Form in front 4 66
Excel Automation VBA 19 116
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question