Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Module from VB (via ADOX)? 1

Status
Not open for further replies.

jasonp45

Programmer
Aug 23, 2001
212
US
From VB or VBScript I can create an Access object, and also create tables and queries using ADOX.

How can I create a module in the Access file? I've found that the below code lets me *add* to an existing module, but I want to create the module first and then add code to it from a file.

Dim oAccess As New Access.Application
With oAccess
.OpenCurrentDatabase "C:\MyDatabase.mdb"
.Modules("ExistingModule").AddFromFile "C:\MyModule.bas"
End With

Thanks!
 
You can use:

Code:
Set m = VBE.ActiveVBProject.VBComponents.add(1)
m.Name = "ABC"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top