Integrating WordPerfect and VB6

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



Who is Participating?
Richie_SimonettiConnect With a Mentor IT OperationsCommented:
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.
Richie_SimonettiIT OperationsCommented:
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.
jtjcompAuthor Commented:
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.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Richie_SimonettiIT OperationsCommented:
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?
An article on this also


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

Is this impossible to do in VB?

Richie_SimonettiIT OperationsCommented:
"The code looks good..."
Then, why did you accept my comment as answer?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.