Loads a classic XLS VBA OLE storage payload from a compound file. The
source file must contain either _VBA_PROJECT_CUR or
_VBA_PROJECT as a top-level storage. The method replaces any
VBA payload already attached to the workbook.
Syntax
function LoadVBAProjectFromFile(FileName: WideString): Integer;
Return value
Returns 1 when the payload is loaded; returns a negative
value if the file cannot be opened or does not contain a supported VBA
storage.
Example
if Workbook.LoadVBAProjectFromFile('C:\Reports\MacroPayload.ole') = 1 then
Workbook.SaveAs('C:\Reports\MacroWorkbook.xls', xlExcel97);
See also