Include external file .BAS in Excel VBA

  • Thread starter Thread starter locoloco
  • Start date Start date
L

locoloco

Can i load external .BAS file, with some kind of include or import?
I use this way to get control over the code.

Tks in Advance!

Rafael Porche
 
In VB editor you can right click on the project and select Import File.
This allows you to get a .bas into your project. It should work as lon
as none of the code uses commands not included with VBA (i.e. VB onl
commands).

Not sure whether the module is saved again with the spreadsheet o
whether it stays where you found it though. Probably with th
spreadsheet, but you should check.
 
Sub AddCode()
ThisWorkbook.VBProject.VBComponents.Import _
FileName:="Y:\Docs\bovey\modAPIPlaySoundA.bas"
End Sub
 
Back
Top