Best way to format a flat file that Excel will load properly?

I'm generating a flat file in Outlook VBA. Right now I'm able to save it as a 
..txt file, although I hope to save it in a delimited flat file format with an 
..xls extension so it will automatically be opened by excel without having to 
go through the whole 'import' sequence.

There are string fields in the file, some of which contain commas- so I 
can't make it a comma delimited file. 

What is the best delimiter to use so that Excel will automatically recognize 
and parse the flat file contents across columns?

Currently in 2003, but strongly prefer solutions that will also work in 2007

Many thanks,
Keith
0
Utf
1/9/2010 12:55:01 AM
excel.programming 6508 articles. 2 followers. Follow

8 Replies
1001 Views

Similar Articles

[PageSpeed] 56

Hi ker_01,

You can use a csv file by enclosing each field that might contain commas in double quotes.

Applying an xls extension to a text file does not a valid Excel file make and is liable to generate an error message when Excel 
tries to open it. Plus, if you then proceed to open the file, all the data will probably be in one column.

-- 
Cheers
macropod
[Microsoft MVP - Word]


"ker_01" <ker01@discussions.microsoft.com> wrote in message news:4DDBC7F0-3966-436C-80EC-54908AA3244F@microsoft.com...
> I'm generating a flat file in Outlook VBA. Right now I'm able to save it as a
> .txt file, although I hope to save it in a delimited flat file format with an
> .xls extension so it will automatically be opened by excel without having to
> go through the whole 'import' sequence.
>
> There are string fields in the file, some of which contain commas- so I
> can't make it a comma delimited file.
>
> What is the best delimiter to use so that Excel will automatically recognize
> and parse the flat file contents across columns?
>
> Currently in 2003, but strongly prefer solutions that will also work in 2007
>
> Many thanks,
> Keith 

0
macropod
1/9/2010 3:51:17 AM
On Sat, 9 Jan 2010 14:51:17 +1100, "macropod" <macropod@invalid.invalid>
wrote:

>Hi ker_01,
>
>You can use a csv file by enclosing each field that might contain commas in double quotes.
>
>Applying an xls extension to a text file does not a valid Excel file make and is liable to generate an error message when Excel 
>tries to open it. Plus, if you then proceed to open the file, all the data will probably be in one column.


  Using a sig AND being a top poster is a RETARDED combination as your
sig causes the message you responded to to get snipped.

  You're an idiot.  Either STOP using a sig as they are NOT even needed,
or STOP top posting, friggin idiot.
0
FatBytestard
1/9/2010 4:42:46 PM
On Fri, 8 Jan 2010 16:55:01 -0800, ker_01
<ker01@discussions.microsoft.com> wrote:

>I'm generating a flat file in Outlook VBA. Right now I'm able to save it as a 
>.txt file, although I hope to save it in a delimited flat file format with an 
>.xls extension so it will automatically be opened by excel without having to 
>go through the whole 'import' sequence.
>
>There are string fields in the file, some of which contain commas- so I 
>can't make it a comma delimited file. 
>
>What is the best delimiter to use so that Excel will automatically recognize 
>and parse the flat file contents across columns?
>
>Currently in 2003, but strongly prefer solutions that will also work in 2007
>
>Many thanks,
>Keith

  If you are creating the text file, and you get to insert the
delimiters, then you can choose a character other than a comma, no
problem.

  When you go to import it into an excel workbook (yes, this step is
required), you choose the delimiter that you constructed the text file
with, and it will import it perfectly every time as long as the character
you chose does not "pop up" in the data strings you are trying to import.

  So, choose carefully.
0
CellShocked
1/9/2010 4:46:15 PM
Hi FatBytestard,

Have a nice day!

-- 
Cheers
macropod
[Microsoft MVP - Word]


"FatBytestard" <FatBytestard@somewheronyourharddrive.org> wrote in message news:lbchk5tkk5sjdro8oeqdcdbpdiaaia7b62@4ax.com...
> On Sat, 9 Jan 2010 14:51:17 +1100, "macropod" <macropod@invalid.invalid>
> wrote:
> 
>>Hi ker_01,
>>
>>You can use a csv file by enclosing each field that might contain commas in double quotes.
>>
>>Applying an xls extension to a text file does not a valid Excel file make and is liable to generate an error message when Excel 
>>tries to open it. Plus, if you then proceed to open the file, all the data will probably be in one column.
> 
> 
>  Using a sig AND being a top poster is a RETARDED combination as your
> sig causes the message you responded to to get snipped.
> 
>  You're an idiot.  Either STOP using a sig as they are NOT even needed,
> or STOP top posting, friggin idiot.
0
macropod
1/11/2010 1:14:50 AM
On Mon, 11 Jan 2010 12:14:50 +1100, "macropod" <macropod@invalid.invalid>
wrote:

>macropod

  What an idiot.
0
FatBytestard
1/11/2010 2:29:28 AM
Thank you to macropod and Cellshocked for your responses.

I am now saving the file as a txt file, and have used commas to delimit the 
file, and surrounded string fields with quotes so that 'accidental' commas 
won't throw off the format.

When I right-click the file and say "open with Excel", it still throws each 
entire row into column A.

Are there any tutorials on how to manually format a file output to be more 
Excel-friendly, even (gack) if it means throwing it into XML format?

My alternative is to have Outlook create an instance of Excel, and dump the 
contents directly into Excel instead of a flat file... but I'd be treading in 
unfamiliar waters, given that this needs to work in a mixed 2003/2007 
environment.

Thank you!!
Keith

"macropod" wrote:

> Hi ker_01,
> 
> You can use a csv file by enclosing each field that might contain commas in double quotes.
> 
> Applying an xls extension to a text file does not a valid Excel file make and is liable to generate an error message when Excel 
> tries to open it. Plus, if you then proceed to open the file, all the data will probably be in one column.
> 
> -- 
> Cheers
> macropod
> [Microsoft MVP - Word]
> 
> 
> "ker_01" <ker01@discussions.microsoft.com> wrote in message news:4DDBC7F0-3966-436C-80EC-54908AA3244F@microsoft.com...
> > I'm generating a flat file in Outlook VBA. Right now I'm able to save it as a
> > .txt file, although I hope to save it in a delimited flat file format with an
> > .xls extension so it will automatically be opened by excel without having to
> > go through the whole 'import' sequence.
> >
> > There are string fields in the file, some of which contain commas- so I
> > can't make it a comma delimited file.
> >
> > What is the best delimiter to use so that Excel will automatically recognize
> > and parse the flat file contents across columns?
> >
> > Currently in 2003, but strongly prefer solutions that will also work in 2007
> >
> > Many thanks,
> > Keith 
> 
> .
> 
0
Utf
1/11/2010 9:03:02 PM
 It is not "right click and select open with excel".


  You OPEN Excel, and select the "Data" tab and select "from text"

  (you could record these moves in a macro too)

  Also, your file should be a .csv file, NOT a .txt file, though either
will work.

  csv is "comma separated values".  If you already have a pre-parsed
file, give it the pre-parsed file extension name.

 Anyway, opening Excel first and performing an import is the right way,
especially if you have several fields to define.


On Mon, 11 Jan 2010 13:03:02 -0800, ker_01
<ker01@discussions.microsoft.com> wrote:

>Thank you to macropod and Cellshocked for your responses.
>
>I am now saving the file as a txt file, and have used commas to delimit the 
>file, and surrounded string fields with quotes so that 'accidental' commas 
>won't throw off the format.
>
>When I right-click the file and say "open with Excel", it still throws each 
>entire row into column A.
>
>Are there any tutorials on how to manually format a file output to be more 
>Excel-friendly, even (gack) if it means throwing it into XML format?
>
>My alternative is to have Outlook create an instance of Excel, and dump the 
>contents directly into Excel instead of a flat file... but I'd be treading in 
>unfamiliar waters, given that this needs to work in a mixed 2003/2007 
>environment.
>
>Thank you!!
>Keith
>
>"macropod" wrote:
>
>> Hi ker_01,
>> 
>> You can use a csv file by enclosing each field that might contain commas in double quotes.
>> 
>> Applying an xls extension to a text file does not a valid Excel file make and is liable to generate an error message when Excel 
>> tries to open it. Plus, if you then proceed to open the file, all the data will probably be in one column.
>> 
>> -- 
>> Cheers
>> macropod
>> [Microsoft MVP - Word]
>> 
>> 
>> "ker_01" <ker01@discussions.microsoft.com> wrote in message news:4DDBC7F0-3966-436C-80EC-54908AA3244F@microsoft.com...
>> > I'm generating a flat file in Outlook VBA. Right now I'm able to save it as a
>> > .txt file, although I hope to save it in a delimited flat file format with an
>> > .xls extension so it will automatically be opened by excel without having to
>> > go through the whole 'import' sequence.
>> >
>> > There are string fields in the file, some of which contain commas- so I
>> > can't make it a comma delimited file.
>> >
>> > What is the best delimiter to use so that Excel will automatically recognize
>> > and parse the flat file contents across columns?
>> >
>> > Currently in 2003, but strongly prefer solutions that will also work in 2007
>> >
>> > Many thanks,
>> > Keith 
>> 
>> .
>> 
0
Archimedes
1/12/2010 12:56:48 AM
I guess that's really a compliment from someone who wants to go down in history as FatBytestard!

-- 
Cheers
macropod
[Microsoft MVP - Word]


"FatBytestard" <FatBytestard@somewheronyourharddrive.org> wrote in message news:m73lk59vh4smku8pnn3pb9d84s9ip1uva0@4ax.com...
> On Mon, 11 Jan 2010 12:14:50 +1100, "macropod" <macropod@invalid.invalid>
> wrote:
> 
>>macropod
> 
>  What an idiot.
0
macropod
1/13/2010 1:44:49 AM
Reply:

Similar Artilces:

Excel button problem
Hi All I have a macro that copies a worksheet in the active workbook and puts it into a new workbook - then formats it and deletes any buttons on the worksheet. On the first click on the button the macro works ok. On the second click, it fails because the all assigned macros on all buttons in the active workbook changed from "mba" to "book1!mba". Book 1 doesn't exists (wasn't opened, wasn't saved, doesn't have the macros). I've never experienced this problem before?? Can anyone help to solve this problem? FYI The macro to do this is c...

Excel 97 #9
Please can anyone help??? I have two columns in Excel 97. The first contains a list of statu values eg. pending, or granted or withdrawn. The second contains date eg.01/12/1997, 05/06/2003. I woudl like to know how to get all th granted apps before 31/12/2003. Can anyone help please -- Message posted from http://www.ExcelForum.com theres many ways, but an easiest way would be to do a sort. Highlight the 2 columns, click on data, then sort, then sort by status, then by date. this should group them all together. hope this helps...toe >-----Original Message----- >Please can anyo...

Using Relative path for XML data file?
Is there a way to specify a relative path to an XML data file imported into Excel 2003? I am writing a web app that generates report data as XML for the user to download to their local machine. This data is to be consumed by an Excel reporting spreadsheet, which contains display-formatted tables and charts that are mapped to various data fields in an XML Map, which is in turn linked to the xml data file they will download. The idea is the user only needs to download the data for updates, not the whole spreadsheet. However, since I cannot predict the path where the user will store their...

How to repair a .dll file in IE8
Several days ago I noticed in my Dependency Walker that the IESHIMS.dll files has a yellow circle with a question mark on it. What does this mean and How do I repair it? OS: Windows Vista Home Premium Browser Internet Explorer 8 -- TW Hi, See the History tab on that dialog. A web search for ieshims.dll files will also help you find a solution for that file. Regards. "TW" <TW@discussions.microsoft.com> wrote in message news:63E61463-D766-4ABC-B081-BFA8C04FB159@microsoft.com... > Several days ago I noticed in my Dependency Walker that the IESHIMS....

Linking files 2 ways
I have a work book that is linked to another and vise versa. As thus: Workbook A is where the input of data is made; Workbook B has a link to the input from workbook A; Workbook A retrieves the altered data back as a link. Although this all works fine with both books open, I note that if I open workbook A by itself, that the data it retrieves from Workbook B is not updated . If However, both books are open, there's no problem. I thought linked books were updated automatically if the Update remote references has been selected?? But it appears that the second book is not updated until it ...

OL2007 not move big files from outbox to sent
Hi, We have 2 computers with separate email accounts on Roadrunner. One machine has XP with Outlook 2002-sp3 and works without any problems. The other has Outlook 2007 on Vista and has problems sending files over a meg or so in size. It seems to actually send the file but the file remains in the outbox folder and does not move it to the sent folder. I say it "seems" to send the file because some people complain of getting muliple copies and others don't seem to get them at all. If I hit send again (not set up for auto send) it seems to send the file again (why some ...

unsolicited entry in the folder "Temporary Internet Files"
Hello, I am working on a programme which browses web sites and runs under XP. The http download is as follows: pServer = Isession -> GetHttpConnection(strServerName, nPort); pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET, strObject, NULL, 1, NULL, NULL, dwHttpRequestFlags); pFile->SendRequest(); pFile->QueryInfoStatusCode(dwStatusCode); if(dwStatusCode == 200) { pFile -> QueryInfo(HTTP_QUERY_LAST_MODIFIED, &sysT); status.lastMod = sysT; if(DBlastMod == status.lastMod) //URL content has not changed since the last visit ...

find action on log file
Hello there I want to use outside tool to find who made some update on table in my server I know that there are many tools for this. But can they do it on simple recovery model? Roy Goldhammer (royg@yahoo.com) writes: > I want to use outside tool to find who made some update on table in my > server > > I know that there are many tools for this. But can they do it on simple > recovery model? No. If you are using the simple recovery model, the contents of the log is wasted away everyonce in a while. Well, if the disk area has not been overwritten...

conditional formatting sort
Is there a way to sort after conditional formatting. So, if I've set up a conditional format to color my text red if the number is between 0 and 95, then I want to sort so all red numbers are at the top of the spreadsheet? Any ideas? Thanks for your time and assistance. Roberta On Thu, 25 Oct 2007 05:08:00 -0700, rrupp <rrupp@discussions.microsoft.com> wrote: You can't sort by color, but you can add a column to your query like this: SortColumn: Iif(SomeValue >= 0 and SomeValue <= 95, 1, 2) Then sort by this column. -Tom. >Is there a way to sort after condition...

File size #11
I have read the other discussions on file sizes but they do not seem to address my problem. I have an Excel file that is 12mb large with low-res jpegs in it. This file also has merged cells to make it look pretty. Does Excel look at these merged cells as graphics? Is this why they are too big? I have run a macro to make sure that it goes to the last cell. How can I get the file smaller? How big are the graphics? If you remove them from the file, what is the size of the file and what is the size of the graphic files? To be sure you do not have extra formatting, if you open the file...

New to excel
Hi All, I'm new to Excel ( and to this forum :) ) and so I hope somebody may b able to help me. I've got 2 questions.... QUESTION 1 I've got a spreadsheet which takes data from one worksheet and uses i to calculate data in a second worksheet using the following code formula: =IF('4th November 2005'!B19="","nothing here dude",IF(B19<'4th Novembe 2005'!B19,"UP",IF(B19='4th November 2005'!B19,"Same",IF(B19>'4t November 2005'!B19,"DOWN")))) The problem is, when I create a new worksheet I have...

Looking for Excel Help
I'm a very novice Excel user and am looking for a little help with creating a formula for a spreadsheet I'm creating for my personal use. I would appreciate some assistance if possible. Thanks in advance. Dan --- Message posted from http://www.ExcelForum.com/ Hi Dan! Post a sample of what you want to do. Your question is just a tad open ended <g> -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. "DanB4105" <DanB4105.ywtpa@excelfor...

Maximum file sizes
Is there a recommended maximum file size for Excel 2000. PC spec 2Ghz P4 with 256 Mb Any advice appreciated Deus -------------- Does Not Exist Hi have a look at http://www.decisionmodels.com/memlimits.htm -- Regards Frank Kabel Frankfurt, Germany "Deus DNE" <deus.dne@ntlworld.com> schrieb im Newsbeitrag news:1561701c41d4f$358950f0$a001280a@phx.gbl... > Is there a recommended maximum file size for Excel 2000. > > PC spec 2Ghz P4 with 256 Mb > > Any advice appreciated > > Deus > -------------- > Does Not Exist ...

will CRM load on a 2003 server?
will CRM load on a 2003 server? Microsoft CRM v1.2 supports Windows 2000/2003 Server. Frank Lee Workopia, Inc. >> Other Microsoft CRM Online Forum Resources: http://www.workopia.com/Links.htm >-----Original Message----- >will CRM load on a 2003 server? >. > No problem. We just completed a 1.2 installation on a 2003 server, without any problems. Brian Demoe "Troy Hicks" <tlhicks@nc.rr.com> wrote in message news:03dd01c3dcb2$93653a00$a501280a@phx.gbl... > will CRM load on a 2003 server? CRM 1.2 will also load on Small business server 2003 as wel...

Excel corrupts when asking to update vlookups
We are experiencing weird behavior with some Office 2K3 Excel spreadsheets that contain lots of calculations, but no macros. On some pc’s Excel acts normally, on others you get the error. I have a couple of screen shots available. Any help is appreciated. If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Gu...

Uninstall of mappoint has caused errors with excel
Hi, I am running Office 2003 on the terminal server (windows 2003) and had a copy of mappoint as well. This is a mapping program. We ininstalled mappoint which has caused an error message with Excel and other office products. The error says "Cd:\documents and settings\administrator.ocrdc1\application data\microsoft\addins c:\Program files\common files\microsoft shared\geography\mpoai9.dll is not a valid add-in." I then click OK and excel opens up and everything is fine. The problem is that we are using other programs as well such as Quickbooks that export to excel and t...

CSV Files and VLOOKUP error
Does anyone know why VLOOKUP and Compare formulas don't work o information originating from a CSV file? I've tried copying an pasting values only (to leave behind any formatting), but it doesn' help. Through countless tests, I've narrowed it down to the CSV file bein the only possible cause -- Message posted from http://www.ExcelForum.com Hi ajpowers, Just a guess but the imported data may have leading or trailing spaces or are numbers stored as text. You could use the formula =A1=D1 to see if you get a true or false, where A1 is the lookup value and D1 ia the CVS valu...

learning Excel #3
Hi, I was considering learning Excel as an additional tool for my data analysis work. Is it better to use data sets that I have previously used with SPSS and apply the same analysis tools as in SPSS? For applying the appropriate tools, I was considering using excel's online help. The second option I have is to use some excel book for data analysis and apply the techniques to data sets provided with the book. Any suggestions????? regards Metal ...

unable to paste Excel 2003 chart into Outlook 2003
(This was posted on "excel.charting" group.) I have a user who's unable to paste an Excel 2003 chart into Outlook 2003 email message. In Outlook options, the checkbox is selected for "Use Microsoft Office Word 2003 to edit e-mail messages". When I tested this on my own computer running the same version of Office, if the box is check, I have no problem pasting; if this box is cleared, I cannot paste. But on his computer, it doesn't work regardless. Thanks and regards, TL ...

How do I Remove a Split from my Comments in Excel 2003? #2
I have set my current workbook to split/freeze the first column and first 2 rows. Now, when I add a comment to the second row (in any column) my comments are cut off if I should scroll down. I don't ever remember the behavior before. And I don't know what I've done to enable it but it's really annoying. How do turn this off ? ...

How to automate increasing the form cache registry/file etc...
I want to roll out a batch file to make a number of tweaks to CRM The body of it would go REGEDIT /S Kerberosefix.reg REGEDIT /S ForceFormreload.reg REGEDIT /S OutlookFix.reg It would also rename OSA.exe to OSA.bad Remove OSA.exe From the startup menu I need help finding a way to use my batch file to increase the Outlook Form cache from the default 4MB to 50 MB.. This makes CRm more stable and faster for communications. I dont want to manually do this, as it time consuming, are my end users would not be reliable in doing it themselves. I also want to make another batch file or button that...

number format with leading 0
Dose anyone know how to create a number format that would show a leading zero for the numbers 0-9. That is, so that 1 would show as 01. I can do with a text format but would like to retain the integrity of the number. Thanks Try this: Format>Cells>Number Category: Custom Type: 00 Click [OK] Does that help? *********** Regards, Ron "Darby" wrote: > Dose anyone know how to create a number format that would show a leading zero > for the numbers 0-9. That is, so that 1 would show as 01. I can do with a > text format but would like to retain the integrity...

CListCtrl/CImageList. Redraw causes images to load incorrectly.
I have a derived class of CListCtrl that has a CImageList member variable along with a member function called DrawImageList() that is meant to dynamically build an image list from paths that are contained in a column. It works when the dialog is initialized, however when I add something to the listctrl(which then calls DrawImageList) the ordering of the images is unpredicatable. This is thoroughly confusing for me.... void CMyListCtrl::DrawImageList() { //Clean out the current image list and create a new one //based on whats currently in the list control SetRedraw(FALSE); ...

Load image in a unbound control from a attachment field in recor
I have a unbound (single not continuious) form with 16 differant records from the same recordset. No problem loading the this data from recordset in VBA. PROBLEM I need to know how to load the unbound controls with Image's from an attachment field in another recordset The normal method of control = Rs!field does not work Please advise -- Thanks Tom dans l'article 78DC5502-3A76-4562-AA20-736446AB1448@microsoft.com, Tom � Tom@discussions.microsoft.com a �crit le 21/01/08 20:28�: > I have a unbound (single not continuious) form with 16 differant records from > the same record...

Items in this message are still loading. Please wait a moment and try again.
Get this error message when trying to print an HTML email using Outlook 2002 10.6515.6735 SP3. I've seen lots of single post threads regarding this issue with no responses. The problem is, the moment lasts up to an hour. Are there any settings that can be tweaked to speed this process up? Could it possibly be a printer issue? This just recently started happening. Any suggestions are appreciated. I haven't ever experienced this but are you on a slow Internet connection? An hour is an awful long time (which I'm sure you know already) "Geoff" <geoff.warner@gmail...