Me aparece el siguiente error:
Este archivo esta en uso por otra aplicacion
u otro usuario.
(:document and settings\...\normal.dot )
y aparece la ventana , guardar como
Nombre. normal
guardar como tipo. plantilla de documento
Mi codigo es el siguiente bt:
Código Delphi
[-]
var
Word1, Documento, t: OleVariant;
Try
Word1 := CreateOleObject('Word.Application');
SpeedButton1.Caption :='Generando el Registro..';
Word1.Documents.Add('C:\BDATOS_TARJESOFT\ResolucionesTecnicos.rtf');
SpeedButton1.Caption :='Generando el Registro...';
Documento := Word1.Documents.Item(1);
SpeedButton1.Caption :='Enviando Parametros a Word..';
if EdNroRegistro.Text <> '' then
Documento.Variables.Add('NRESOLUCION', EdNroRegistro.Text)
else
Documento.Variables.Add('NRESOLUCION',' ');
if EdNombre1.Text <> '' then
Documento.Variables.Add('NOMBRES', EdNombre1.Text)
else
Documento.Variables.Add('NOMBRES',' ');
Documento.Fields.ToggleShowCodes;
Documento.Fields.Update;
NuevoArchivo := 'C:\BDATOS_TARJESOFT\Tmp\ArchivoTmp'+IntToStr(DMDatos.ObtenerNroConsecutivo)+'.rtf';
Word1.ActiveDocument.SaveAs(NuevoArchivo);
DMDatos.IncrementarNroConsecutivo;
SpeedButton1.Caption :='Abriendo Word...';
Word1.ActiveWindow.View.ShowFieldCodes := false;
SpeedButton1.Caption :='Archivo Completado.';
SpeedButton1.Enabled := true;
SpeedButton1.Caption := ' .:: Visualizar Registro ::.' ;
Word1.Visible := true;
except
on E:Exception do
begin
ShellExecute(Handle, nil, 'tskill', 'winword', nil, sw_hide);
messagedlg(' Verifique sus datos que esten correctamente '+e.Message,mtWarning,[mbok],0);
end;
end;
Screen.Cursor := crDefault;
end;