Import file dialog

M

Mark

I am using excel 97.

I want to try and ease the way a module/form/class module
is imported into a project by way of another macro.

I am using the code:-

ActiveWorkbook.VBProject.VBComponents.Import
FileName:="Mymodule"

But I want to take things step further, if it's possible
by importing a module and being able to choose it from a
Import file dialog.

Ideally from Excel itself and not the VBA editor window.

Is it possible, and if so can someone assist, please?

Mark
 
B

Bernie Deitrick

Mark,

Use code to ask for the filename:

Dim myFile As String
myFile = Application.GetOpenFilename
ActiveWorkbook.VBProject.VBComponents.Import _
Filename:=myFile

HTH,
Bernie
MS Excel MVP
 
Top