export VBA code in forms, modules and reports

  • Follow


I'm wondering if there's an automated (ie, using VBA) method to write the VBA 
code that underlies my forms and reports to a text output file, external to 
the database. For example, if I have a form called frmItems that has a 
module, is there a way I could create a file called "frmItems_vba.txt" that 
would have the VBA code from the module associated with the form? Thanks!
0
Reply Utf 5/19/2010 5:14:05 PM

Take a look at the undocumented SaveAsText method.

I talked about it in my February 2005 "Access Answers" column in Pinnacle 
Publication's "Smart Access". You can read it online at 
http://www.vb123.com/kb/200502_ds_saveas.htm or you can download the column 
(and sample database) for free at 
http://www.accessmvp.com/djsteele/SmartAccess.html

-- 
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"John B. Smotherman" <JohnBSmotherman@discussions.microsoft.com> wrote in 
message news:EABBFCBF-FF2C-4336-B37E-D973D7049B95@microsoft.com...
> I'm wondering if there's an automated (ie, using VBA) method to write the 
> VBA
> code that underlies my forms and reports to a text output file, external 
> to
> the database. For example, if I have a form called frmItems that has a
> module, is there a way I could create a file called "frmItems_vba.txt" 
> that
> would have the VBA code from the module associated with the form? Thanks! 


0
Reply Douglas 5/19/2010 5:59:26 PM


Outstanding! Thanks, Doug. I knew I'd seen something about it SOMEWHERE...

"Douglas J. Steele" wrote:

> Take a look at the undocumented SaveAsText method.
> 
> I talked about it in my February 2005 "Access Answers" column in Pinnacle 
> Publication's "Smart Access". You can read it online at 
> http://www.vb123.com/kb/200502_ds_saveas.htm or you can download the column 
> (and sample database) for free at 
> http://www.accessmvp.com/djsteele/SmartAccess.html
> 
> -- 
> Doug Steele, Microsoft Access MVP
> http://www.AccessMVP.com/DJSteele
> (no e-mails, please!)
> 
> "John B. Smotherman" <JohnBSmotherman@discussions.microsoft.com> wrote in 
> message news:EABBFCBF-FF2C-4336-B37E-D973D7049B95@microsoft.com...
> > I'm wondering if there's an automated (ie, using VBA) method to write the 
> > VBA
> > code that underlies my forms and reports to a text output file, external 
> > to
> > the database. For example, if I have a form called frmItems that has a
> > module, is there a way I could create a file called "frmItems_vba.txt" 
> > that
> > would have the VBA code from the module associated with the form? Thanks! 
> 
> 
> .
> 
0
Reply Utf 5/19/2010 6:58:01 PM

You could use the built-in Documenter.  Go to Tools>Analyze>Documenter.  Go 
to the Forms tab and select all and then click on the Options button.  Select 
Code on top and Nothing on the bottom and deselect the others.  Go to the 
Reports tab and click on the Options button.  Select Code ont top and Nothing 
on the bottom and deselect the others.  Go to the Modules tab, select all and 
then click on the Options button.  Select Code and deselect the others.  

Click the OK button and it will prepare the report.  It may take a few 
minutes if you have an extremely complex database.  When it is complete, 
select File>Export and export it as a .txt file.


"John B. Smotherman" wrote:

> I'm wondering if there's an automated (ie, using VBA) method to write the VBA 
> code that underlies my forms and reports to a text output file, external to 
> the database. For example, if I have a form called frmItems that has a 
> module, is there a way I could create a file called "frmItems_vba.txt" that 
> would have the VBA code from the module associated with the form? Thanks!
0
Reply Utf 5/19/2010 7:02:01 PM

3 Replies
566 Views

(page loaded in 0.054 seconds)


Reply: