Finding and copying Access modules

dsm

New Member
Joined
Apr 14, 2007
Messages
44
Hi guys,
I would like to programatically

-search my local disk drive
-find each access database file
-check if it contains any public modules
-copy each module to a master database
or
-save each module as a text file


I would appreciate if anyone could provide some sample VBA code that could be modified to acheive my objectives


thanks
David
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700

dsm

New Member
Joined
Apr 14, 2007
Messages
44
Nate,
Thanks for these links, I have got much further with your help.
however the following code extract isn't doing what I need.

Code:
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase sMatchFile

Set DB = DBEngine.Workspaces(0).OpenDatabase(sMatchFile)

For intI = 0 To DB.Containers("Modules").Documents.Count - 1
   strModuleName = DB.Containers("Modules").Documents(intI).Name
   strNewLoc = strMyloc & "\" & strModuleName & strMyExt

   DoCmd.OutputTo acOutputModule, strModuleName, acFormatTXT, _
      strNewLoc, 0

Next intI

The code successfully identifies modulue names in both master and slave databases.
The DoCmd... is successful exporting modules in the master database but fails when I want to export a module from a slave database.

I am using Access97 and get the following error
Run-time error 2501
The OutputTo action was cancelled


Is there any way for VBA code in a master DB to export a module from a slave DB.


Any help appreciated

Thanks
David
 

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700

Forum statistics

Threads
1,181,102
Messages
5,928,062
Members
436,586
Latest member
latintxn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top