uses ComObj;
procedure DocPageSetup(const DocFileName: string);
const
wdAlertsNone = $00000000;
wdDialogFilePageSetup = $000000B2;
var
DocApp: OleVariant;
begin
try
try
DocApp := CreateOleObject('Word.Application');
DocApp.DisplayAlerts := wdAlertsNone;
DocApp.Documents.Open(DocFileName);
DocApp.Dialogs.Item(wdDialogFilePageSetup).Show;
DocApp.Visible := False;
DocApp.ActiveDocument.Save;
except
end;
finally
if not VarIsEmpty(DocApp) then
DocApp.Quit;
DocApp := Unassigned;
end;
end;