A VBA script has to be within an Excel workbook, either a normal workbook,
or an add-in.
You can write a COM add-in, in say VB, which can be loaded in Excel, but
this is a tad more difficult.

Signature
---
HTH
Bob
(change the xxxx to gmail if mailing direct)
> Question: Is it possible to have a standalone VBA script file that Excel
> can open, or does the VBA have to be written into an Excel document? If so
> how is it done?
>
> Ta
> T
Harlan Grove - 28 Dec 2006 18:17 GMT
Bob Phillips wrote...
>A VBA script has to be within an Excel workbook, either a normal workbook,
>or an add-in.
>
>You can write a COM add-in, in say VB, which can be loaded in Excel, but
>this is a tad more difficult.
...
Since the VBE may be automated, it's possible to use a macro already in
a workbook to create new modules, load code from text files into those
modules, then run newly added procedures via Application.Run. Messy and
lots of trouble getting such code robust.
An alternative is VBScript files. Excel can run then via VBA's Shell
function, and VBScript can use GetObject to latch onto running Excel
application instances. Slightly less messy, IMO.