Importing Macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have some macros saved as .bas files that people need to be able to import
into their Excel. Their experience on importing is limited, so I need to be
able to explain to them how to import these files. Is there an easy way to
import the .bas files into Excel?

Thanks.
 
Daren,

Is there a specific file that you need to have the BAS imported into, or just have it available?

In the first case, you could write a macro like this (with a reference set to MS VBA Extensibility)

Sub AddModuleByImportToPersonalXLS()
Dim myBook As Workbook
Dim myFile As String

myFile = "C:\Excel\myVBAFileName.bas"
Set myBook = Workbooks("Personal.xls")
myBook.VBProject.VBComponents.Import (myFile)
End Sub


If it just needs to be available, make your file into an add-in....

HTH,
Bernie
MS Excel MVP
 
You may find it easier to create a new workbook and put all the code you want to
share with the others in that new workbook's project.

Then you can just share that workbook with others.
 
Back
Top