2
Situation is the following I have a system that makes automation of the Word and at the time of salvage the document he is not saving. It is not what it is, because it only occurs in the Client.
procedure TfrmConsultas.Salvar1Click(Sender: TObject);
var
FileName : String;
const
wdFormatDocument = 16; // 16 is Word default document file format. For Microsoft Office Word 2007, this is the DOCX format.
begin
if DM.tbConsultas.State in [dsInsert] then
begin
// Trecho de código faz referencia ao nome do arquivo.
DM.tbConsultasConsulta.Last;
FileName := DM.tbParametrosPASTA_BD.AsString+'\Modelos\Consulta_'+IntToStr(DM.tbConsultasConsultaCODIGO_CONSULTA.AsInteger+1)+'.docx';
// Melhor maneira de Salvar os Documentos MS Word no Delphi
// Parâmetro FileName = Nome do Arquivo
// Parâmetro wdFormatDocument = Formato do Arquivo MS Word Verificar outros
// Parâmetro CompatibilityMode = Compatibilidade com outras verções do Word
// possíveis tipos. Atualmente somente Docx
OleContainer.DoVerb(ovInPlaceActivate);
try
OleContainer.OleObject.SaveAs (FileName, wdFormatDocument, EmptyParam, EmptyParam, False);
except
on E : Exception do
ShowMessage(E.ClassName+' error ao Salvar o arquivo DOCX : '+E.Message);
end;
// Nome do arquivo agora sera usado para Salvar o registro na tabela ou deletar o arquivo
vNomeArquivo := 'Consulta_'+IntToStr(DM.tbConsultasConsultaCODIGO_CONSULTA.AsInteger+1)+'.docx';
end;
end;
I don’t know if it’s the folder permissions but, I’ve already checked this all marked for full control and yet the file is not saved.
That’s probably write access to the folder. see how are the attributes of the folder and if the folder is shared see if it is released to write to other users.
– ProsTecnologia