Re: Chip Pearson Import/Export Macros - Added Twist

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Chip Pearson (chip_at_cpearson.com)
Date: 04/04/04


Date: Sun, 4 Apr 2004 15:56:09 -0700

Try something like the following code:

    Dim FName As String
    Dim FNum As Integer
    Dim Rng As Range
    FName = "C:\Test2\Test2.txt" ' change as desired
    FNum = FreeFile()
    Open FName For Output As #FNum
    For Each Rng In Selection.Cells ' change range as desired
        Print #FNum, Rng.Text
    Next Rng
    Close #FNum

-- 
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"saturnin02" <saturnin02_at_hotmail.com> wrote in message
news:OWdbmZpGEHA.408@TK2MSFTNGP10.phx.gbl...
> Chip,
> Everything works good with the export to text macro.
> I need to modify it to reflect a specila twist so that another program can
> read it, and that is I want the macro to export all cell values as text,
but
> put each cell value in one column only i.e. in destination file.
>
> A1 A2 A3
> B1 B2 B3
>
> to
> A1
> A2
> A3
> B1
> B2
> B3
>
> Is it possible to modify it that way?
> Sorry, put I am using a program in DELPHI that will only import text files
> with values in one column only.
>
> Let me know.
> Tx,
>


Relevant Pages

  • Re: Challenging?
    ... Dim FNum As Integer ... Microsoft MVP - Excel ... Team\SE Airports TSA Team ...
    (microsoft.public.excel.programming)
  • Re: Read info from a file
    ... Dim fnum As Integer, isopen As Boolean ... Open filename For Input As #fnum ... Debug.Print strSQLSVR ' Print to the Immediate window. ...
    (microsoft.public.vb.syntax)
  • Re: Reading Files Byte-For-Byte
    ... > A bit confusing here. ... > Dim fnum as long ... > Also a bit confused about reading non-text data into a text file? ...
    (microsoft.public.vb.general.discussion)
  • Re: Namebox entries in a list box
    ... For Each Rng In Range ... FNum = FreeFile ... Open Rng.Value & ".txt" For Output Access Write As #FNum ... I would like the user to be able to use a selection from the name box ...
    (microsoft.public.excel.misc)
  • Re: Reading Files Byte-For-Byte
    ... attempting to read the file into an array. ... Dim fnum as long ... Open ifilename For Binary As #fnum ...
    (microsoft.public.vb.general.discussion)