Option Explicit
Sub ImportCodeModule()
Dim Filt$, Title$, FileName$, Message As VbMsgBoxResult
Do Until Message = vbNo
Filt = "VB Files (*.bas; *.frm; *.cls)(*.bas; *.frm; *.cls)," & _
"*.bas;*.frm;*.cls"
Title = "SELECT A FOLDER - CLICK OPEN TO IMPORT - " & _
"CANCEL TO QUIT"
FileName = Application.GetOpenFilename(FileFilter:=Filt, _
FilterIndex:=5, Title:=Title)
On Error GoTo Finish
Application.VBE.ActiveVBProject.VBComponents.Import _
(FileName)
Message = MsgBox(FileName & vbCrLf & " has been imported " & _
"- more imports?", vbYesNo, "More Imports?")
Loop
Finish:
End Sub
|