If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
But yeah, create a new workbook.
hit alt-f11 to get to the vbe
hit ctrl-R to see the project explorer
rightclick on your project and select Insert|module
Paste the code in.
But visit Chip's site and take a couple of procedures:
Steal this one (near the bottom)
Public Sub DoTheExport()
And this one (about halfway down):
Public Sub ExportToTextFile(FName As String, _
Sep As String,
SelectionOnly As Boolean)
then back to excel and save that workbook with a nice name.
Then open your workbook to be exported.
Select your range (or not, it'll ask you if you want just the selection).
then tools|macro|macros...
click on "DoTheExport" (with the workbook name prepended)
And watch the data fly!
======
Some links that accomplish the same thing as Chip's code:
Earl Kiosterud's:
http://www.tushar-mehta.com/
Look for Text Write in the left hand frame.
J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html
(You may want to try Earl's. It may be sufficient as is.)
saturnin02 wrote:
Tom,
I am a newbie in VBA.
Do I just copy and paste the code into a module...? In a separate file....
How do I actually get this going?
Tx,
S
--
Dave Peterson