Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    May 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Export to a text file (vba)

    Hi,

    Im trying to export some data to a text file on c: . I want to start with the headings that are in B6 & C6, but Im not really getting anywhere.
    Basically my first line of code is open "c: test.txt" For output as #1. Then Im trying Activesheet.cells("B6:C6"). But nothing happens ??

    Any suggestions?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Export to a text file (vba)

    While you could painstakingly move bits and pieces of data to your file, perhaps it would be easier to select the range you're interested in, copy, create a new sheet and paste the data in there, and then save that sheet (mySheet.SaveAs) using a text format or whatever format you want to create? Of course, if you're only interested in a few pieces of data, then, never mind. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  3. #3
    New Lounger
    Join Date
    May 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export to a text file (vba)

    Thanks for the tip, I'll give it a go.

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Export to a text file (vba)

    Also, scroll
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    New Lounger
    Join Date
    May 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export to a text file (vba)

    Very handy.

    Thanks for that. Much appreciated.

    Cheers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •