Solved

Integrating WordPerfect and VB6

Posted on 2002-05-08
8
206 Views
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..

TIA

J.

0
Comment
Question by:jtjcomp
  • 4
  • 2
  • 2
8 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
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.
0
 
LVL 1

Author Comment

by:jtjcomp
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.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
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?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:n_narayanan
ID: 6998051
0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6998053
An article on this also

http://www.freevbcode.com/ShowCode.Asp?ID=4021

Cheers

Narayanan
0
 
LVL 1

Author Comment

by:jtjcomp
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?

0
 
LVL 16

Accepted Solution

by:
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.
0
 
LVL 16

Expert Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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