Example needed for WordApp.Documents.Open

Add-in Express™ Support Service
That's what is more important than anything else

Example needed for WordApp.Documents.Open
 
Frank Schindler




Posts: 2
Joined: 2006-03-15
Hi all,

I'm trying to open a Word document from inside a Add-in and always a EOleSysError exception 'Type conflict' is fired.

My source:


procedure TAddInModule.bicOpenDocAction(Sender: TObject);
var
  ANull : OleVariant;
  AFile : OleVariant;
begin
//  ceUtils.DLLPath := COMAddInClassFactory.FilePath;
//  ceUtils.HostType := HostType;
//  ceOpenWizardForm := TceOpenWizardForm.Create(nil);
  try
//    if ceOpenWizardForm.ShowModal = mrOK then
    begin
      AFile := '"I:ProjekteListecContentExplorerDelphi SourceSerachDocsFOS_GRID_DATA_MODEL.doc"';
//      AFile := ceOpenWizardForm.FileName;
      case HostType of
        ohaExcel : ExcelApp.Workbooks.Open(AFile,
          Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, Null,
          Null, -1);
        ohaWord : WordApp.Documents.Open(AFile,
          ANull, ANull, ANull, ANull,
          ANull, ANull, ANull, ANull, ANull, ANull,
          ANull);
        ohaPowerPoint : PowerPointApp.Presentations.Open(AFile,
          Null, Null, Null);
      end;
    end;
  finally
    FreeAndNil(ceOpenWizardForm);
  end;
end;


What am I doing wrong?

TIA,
Frank
Posted 15 Mar, 2006 10:39:04 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Frank,

Try to use the EmptyParam variable instead of NULL or ANull.

Posted 15 Mar, 2006 10:57:32 Top
Frank Schindler




Posts: 2
Joined: 2006-03-15
Hi Dmitry,

thanks a lot. It worked.

Posted 15 Mar, 2006 11:08:47 Top