Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 25th, 2007, 11:24 AM
Authorized User
 
Join Date: Jul 2007
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Import from Excel sheet to a text file

Hi,
I'm hoping someone can give me a hints into the right direction on this.
I am trying to export data from one of my excel sheet into a text file.
when I use code below
ActiveWorkbook.SaveAs "C:\Data" & i1 & ".txt", xlCSV

which save data as a text file but I am getting extra doulbe quote before and after (i.e "`P`," "2," "02-MAY-07 ," "02-MAY-07 ," "`STAT`,")
But I want see something like (i.e `P`, 2, 02-MAY-07, 02-MAY-07 , `STAT`)
I am using formula/function [i.e =IF(NOT(ISBLANK(JE_Input!$A2 )),"`P`,","")] to format data from one sheet to another.
Let me know your thought what is the best way to do this.

Thanks in advance...


  #2 (permalink)  
Old July 26th, 2007, 10:34 AM
Friend of Wrox
Points: 513, Level: 8
Points: 513, Level: 8 Points: 513, Level: 8 Points: 513, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: Davenport, IA, USA.
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts
Default

When you save as CSV it automatically puts in quotes around strings. It sounds like you're having the quotes with a comma appear in the actual cell. In other words, don't preformat the data. Have the sheet you want to save into CSV active and it should work.



Similar Threads
Thread Thread Starter Forum Replies Last Post
CSV and Excel sheet import itHighway Classic ASP Professional 0 August 5th, 2006 08:25 AM
Import Data from Open Excel Sheet to Access chintu4u Pro VB Databases 0 May 15th, 2006 01:24 AM
import data from text file to excel(VBA) topr Excel VBA 2 August 26th, 2004 11:36 PM
Excel IMport Text Help!! money Excel VBA 2 April 30th, 2004 12:43 AM
Excel text Import and VB Franck Excel VBA 0 January 8th, 2004 09:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.