Mark A Matte
markamatte at hotmail.com
Sat Mar 29 18:43:34 CDT 2008
Shamil, Thank you very much. I will try this on Monday. This seems to be the 'Icing on the cake' for my current project. Thanks agin to all that contributed. Mark A. Matte > From: shamil at users.mns.ru > To: accessd at databaseadvisors.com > Date: Sat, 29 Mar 2008 00:11:18 +0300 > Subject: Re: [AccessD] VBE Experience anyone? > > Hi Mark, > > Here is how you can use Automation to process modules in other mdb: > > Public Function ProcessExtModules() > Dim mdb As String > mdb = "C:\Temp\test.mdb" > Dim acc As Access.Application > > Set acc = New Access.Application > acc.OpenCurrentDatabase (mdb) > > ProcessModules acc > > acc.CloseCurrentDatabase > > acc.Quit acQuitSaveNone > > Set acc = Nothing > > End Function > > Public Function ProcessModules( _ > ByRef rapp As Access.Application) > > Dim oVBE As Object > Dim mdl As Object > Dim blnFound As Boolean > Dim StartLine As Long > Dim StartColumn As Long > Dim EndLine As Long > Dim EndColumn As Long > > 'To make life easier and lines shorter. > Set oVBE = rapp.VBE.ActiveVBProject.VBComponents > > Dim s As String > s = "" > > 'Check each module ... > For Each mdl In oVBE > If Len(s)> 0 Then s = s + vbCrLf > 'for the required procedure ... > 'Debug.Print oVBE(mdl.Name).CodeModule > s = s + oVBE(mdl.Name).CodeModule > Next > > Debug.Print s > MsgBox s > End Function > > I do not know about tutorials. They could exist but I never used them - all > the above info is from MS Access/VBA online help and own R&D.... > > Beware: to master working with Automation (if you are only starting to do > that) can take a lot of time... > > -- > Shamil > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte > Sent: Friday, March 28, 2008 11:30 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] VBE Experience anyone? > > > Thanks Shamil and Jack, > > > I found the solution you sent Jack...it actually opens each > db/form/module...as for the VBE...I think I'm a little over my head for a > Friday. > > I found this snippet...but too late in the week to try and get it to work > today...will try again tomorrow. I cut all the extra stuff out... > > Shamil...How difficult is the code below to point to a different mdb...or > can you point me a tutorial or articles? I'm looking to get the text of the > form modules. > > Thanks Again, > > Mark A. Matte > > ****************************** > Sub AddDAO() > Dim oVBE As Object > Dim mdl As Object > Dim blnFound As Boolean > Dim StartLine As Long > Dim StartColumn As Long > Dim EndLine As Long > Dim EndColumn As Long > > 'To make life easier and lines shorter. > Set oVBE = VBE.ActiveVBProject.VBComponents > > 'Check each module ... > For Each mdl In oVBE > 'for the required procedure ... > Debug.Print oVBE(mdl.Name).CodeModule > Next > End Sub > ****************************** > >> From: shamil at users.mns.ru >> To: accessd at databaseadvisors.com >> Date: Fri, 28 Mar 2008 22:22:02 +0300 >> Subject: Re: [AccessD] VBE Experience anyone? >> >> Hi Mark, >> >> Do you meant other projects *referenced* by current MS Access application >> database? >> >> Set reference to "Microsoft Visual Basic for Application Extensibility > 3.5" >> (VBIDE - usually located at C:\Program Files\Common Files\Microsoft >> Shared\VBA\VBA6\VBE6EXT.OLB) >> >> And then this code will list all the referenced ms access projects >> >> Dim prj As VBProject >> For Each prj In VBE.VBProjects >> Debug.Print prj.Name >> Next prj >> >> and for each project you can use your code: >> >> For Each prj In VBE.VBProjects >> For Each vbComp In prj.VBE.VBProjects(1).VBComponents >> .... >> >> If you wanted to list/process modules in any (not only referenced) ms > access >> database this way (i.e. using VBIDE) then there are at least two ways to > do >> that: >> >> - write COM add-in; >> - start another MS Access instance from your main MS Access instance, open >> external mdb in it (prevent AutoExec macro to run or start-up forms to > open) >> and use Automation + VBIDE... >> >> -- >> Shamil >> >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark A Matte >> Sent: Friday, March 28, 2008 8:53 PM >> To: Access Developers discussion and problem solving >> Subject: [AccessD] VBE Experience anyone? >> >> >> Hello All, >> >> I am using the code below to loop through the Modules and find stuff. It >> always points to the current db. Is there any way to point this to a >> different database...if so anyone know the syntax? >> >> Thanks Again, >> >> Mark A. Matte >> >> *************** >> For Each vbComp In VBE.VBProjects(1).VBComponents With vbComp >> StartLine = 1 StartColumn = 1 EndLine = >> vbComp.CodeModule.CountOfLines EndColumn = 60 >> strCode = .CodeModule.Lines(1, .CodeModule.CountOfLines) >> ************* >> _________________________________________________________________ >> Test your Star IQ >> http://club.live.com/red_carpet_reveal.aspx?icid=redcarpet_HMTAGMAR >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com > > _________________________________________________________________ > In a rush? Get real-time answers with Windows Live Messenger. > http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh > _realtime_042008 > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com _________________________________________________________________ Test your Star IQ http://club.live.com/red_carpet_reveal.aspx?icid=redcarpet_HMTAGMAR