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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top