Greetings All,

I have tried the following without success. I have tried sfrmFile and sdataFile as both string and WideString and both as variables and constants and when it gets to the line WPObject.MergeFileAssociate(sFrmFile, sDataFile); I get an error when running within Delphi "Project WPTest.exe rasied exception class EOLEException with message 'MergeFileAssociate'. Process stopped. Use Step or Run to continue." If I run outside of Delphi, no error meesage at all.

I also tried WPObject.FileOpen(sFrmFile); and got the same result

Here is the simple source:

procedure TForm1.Button1Click(Sender: TObject);
var
 WPObject: OLEVariant;
 sPath: String;
 sfrmFile: WideString;
 sdataFile: WideString;
 sDocFile: String;
{
const
 sfrmFile: WideString = 'C:\Temp\DELPHI\WordPerfect\Customer.frm';
 sdataFile: WideString = 'C:\Temp\DELPHI\WordPerfect\datafile.dat';}
begin
 sPath := 'C:\Temp\DELPHI\WordPerfect\';
 sFrmFile := sPath + 'Customer.frm';
 sDataFile := sPath + 'datafile.dat';
 sDocFile := sPath + 'Customer.wpd';

{X
 try
   WPObject := CreateOleObject('WordPerfect.PerfectScript.13');
   WPObject.MergeFileType(1);
   WPObject.AppMinimize;
   WPObject.AppRestore;
   WPObject.MergeFileAssociate(sFrmFile, sDataFile);
   WPObject.MergeSelect(0);
   WPObject.MergeRun(2, sFrmFile, 2, sDataFile,1);
//  objWP1.PrintFullDoc;
   WPObject.Quit;
 Finally
   WPObject := Null;
 end;
}

 try
//* Connect to the object. If it fails to connect, create a new instance of the application
   try
     //* Use existing...
     WPObject := GetActiveOLEObject('WordPerfect.PerfectScript.13');
   except
     //* Create new...
     WPObject := CreateOleObject('WordPerfect.PerfectScript.13');
   end;

   case cboMergeKind.ItemIndex of
     0: begin
          WPObject.FileOpen(sFrmFile);
          WPObject.AppMaximize;
          WPObject.AppRestore;
          WPObject.Quit;
         end;
     1:;
     2:;
     3:;
   end;
//    WPObject.Quit;
 Finally
   WPObject := Null;
 end;
end;

Can anyone help me to get this working?

I could send a zip file showing my issue for anyone who is interested.

I appreciate all who reply.

Mike
__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

Reply via email to