Portfolio intend Windows scripters should use the full VB. Both VBA and VBS (VBScript) are lightweight versions of VB that don't require compiled VB executables or DLLs. While VBA allows a reference to be made to the Portfolio VB TLB, VBScript only supports late binding via the CreateObject() and GetObject() methods. From experiment, Portfolio v5 appears to be incompatible with the late binding methods of initiation, but v6 and v7 appear to work correctly.
VB.Net can be used though older OSs, i.e. pre Windows XP SP2, will need the .NET framework installed (about 20Mb - free download from Microsoft). Otherwise use the TLB as a reference as you would in a VB project.
Whilst in VB the "References" menu item is on the Project menu, in VBA it is on the Tools menu in the VBA IDE. The example below shows a VBA Reference being created in Excel XP (on Win 2000) to Portfolio v5's TLB:
...on the References dialog scroll to the Portfolio entry (Portfolio = v4, Portfolio_V5 = v5, Portfolio_V6 = v6):
Although the example above uses Excel XP you should be able to use this procedure in Office programs (from 95 to XP) such as Access or PowerPoint. In addition, you should be able to use this in any program that supports VBA and has a VBA IDE - as with Office programs use the Tools -> Reference menu.
It is probably worth stating that the computer on which you run VBA code (if different from your development machine) must have both the VBA-hosting program (e.g. Excel) and the Portfolio client installed. For VBS, the target machine simply needs the Portfolio client. VBS script files can be executed directly or run from a BAT file, command line, etc.
FWIW, the Portfolio project staff have confirmed there was no intent to support other than full VB and that any functionality achieved via VBA/VBScript would thus be accidental and not supported (even then scripting as a whole is not formally supported). Whilst this means Tech Support won't help you with VBA issues (or any scripting issues actually) I don't believe you should find any significant problems using VBA instead of VB apart from VBA's normal limitations compared to VB. As regards VBS you may find your 'mileage my vary' - so test first!
Question: Can I use VBA, VBScript or VB.Net instead of VB? [FAQ00243.htm]
Last Update:- 31 May 2006
Site and articles © Mark Anderson 2001-2007 - Visit my home page