Dokumentacija HotXLS
Vsebina
Domov
Pregled
TGridToXLS
IXLSWorkbook
Domov
Vsebina
Pregled
VBADefined metoda
Vrne true if Workbook contains VBA code
Skladnja
function VBADefined:boolean;
Opis
Use VBADefined before overwriting an existing workbook when
your application must preserve files that contain macros. The method is
a read-only check; it does not create, remove, or edit VBA modules
In the classic XLS facade, a True result means that the workbook has a
VBA project stream. Save the file with an Excel format that can keep VBA
content, and avoid exporting it to text, HTML, or RTF if macro
preservation is required
Primer
This example opens an existing workbook and checks whether it contains
VBA code before saving it
var
Workbook: IXLSWorkbook;
begin
Workbook := TXLSWorkbook.Create;
try
Workbook.Open('C:\Reports\Template.xls');
if Workbook.VBADefined then
ShowMessage('This workbook contains VBA code.');
Workbook.SaveAs('C:\Reports\TemplateCopy.xls');
finally
Workbook := nil;
end;
end;
Glej tudi
IXLSWorkbook.Openmetoda
IXLSWorkbook.SaveAsmetoda
vmesnik IXLSWorkbook
Copyright © 2010-2026 losLab Software