Need a simple macro that will import any one of a number of text files in a folder

I'm having problems coming up with a macro that will allow me to
import a text file of choice from my default file location that I have
set up with Excel which contains several text files.  I want the macro
to open a "Open" file dialog window where I can then choose the text
file of choice.  I also need it to open the file as delimited,
starting at row 23 and with the tab selected as the only delimiter. 
Please help...


thanks,

steve
0
sspatriots (78)
9/14/2004 3:16:40 PM
excel 39879 articles. 2 followers. Follow

3 Replies
602 Views

Similar Articles

[PageSpeed] 49

Steve
I have been using the following for several years to obtain a spreadsheet
from a .csv file downloaded from a bank.
You will need to add the steps for the deletion of the 22 rows not required.
Hope it helps - so long since I wrote it I cant remember why certain steps
are there - but it does work!

Sub ImportMyFile()
'**************************************************************
' Import My File Macro
' Macro to import csv file into Excel
'**************************************************************
    myFile = Application.GetOpenFilename("All Files,*.*")
    Workbooks.OpenText FileName:=myFile, _
        Origin:=xlWindows, _
        StartRow:=1, _
        DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, _
        ConsecutiveDelimiter:=False, _
        Tab:=True, _
        Semicolon:=False, _
        Comma:=True, _
        Space:=False, _
        Other:=False, _
        FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), _
            Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), _
            Array(8, 1), Array(9, 1), Array(10, 1))
End Sub


Cheers
Don


"Steve" <sspatriots@yahoo.com> wrote in message
news:6d6936c7.0409140716.fc45ee4@posting.google.com...
> I'm having problems coming up with a macro that will allow me to
> import a text file of choice from my default file location that I have
> set up with Excel which contains several text files.  I want the macro
> to open a "Open" file dialog window where I can then choose the text
> file of choice.  I also need it to open the file as delimited,
> starting at row 23 and with the tab selected as the only delimiter.
> Please help...
>
>
> thanks,
>
> steve


0
9/14/2004 8:22:47 PM
I like Don's suggestion to use getopenfilename to pause for the filename, but I
think I'd record a macro when I did it once manually.

There's an option inside that text to columns wizard that allows you to give it
a starting row.  And you'll be assured that you parsed the data correctly.



Steve wrote:
> 
> I'm having problems coming up with a macro that will allow me to
> import a text file of choice from my default file location that I have
> set up with Excel which contains several text files.  I want the macro
> to open a "Open" file dialog window where I can then choose the text
> file of choice.  I also need it to open the file as delimited,
> starting at row 23 and with the tab selected as the only delimiter.
> Please help...
> 
> thanks,
> 
> steve

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
9/14/2004 9:13:18 PM
thanks folks, it worked great, steve



"Don Cameron" <doncameron@bigfoot.com> wrote in message news:<ci7jq6$sol$1@lust.ihug.co.nz>...
> Steve
> I have been using the following for several years to obtain a spreadsheet
> from a .csv file downloaded from a bank.
> You will need to add the steps for the deletion of the 22 rows not required.
> Hope it helps - so long since I wrote it I cant remember why certain steps
> are there - but it does work!
> 
> Sub ImportMyFile()
> '**************************************************************
> ' Import My File Macro
> ' Macro to import csv file into Excel
> '**************************************************************
>     myFile = Application.GetOpenFilename("All Files,*.*")
>     Workbooks.OpenText FileName:=myFile, _
>         Origin:=xlWindows, _
>         StartRow:=1, _
>         DataType:=xlDelimited, _
>         TextQualifier:=xlDoubleQuote, _
>         ConsecutiveDelimiter:=False, _
>         Tab:=True, _
>         Semicolon:=False, _
>         Comma:=True, _
>         Space:=False, _
>         Other:=False, _
>         FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), _
>             Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), _
>             Array(8, 1), Array(9, 1), Array(10, 1))
> End Sub
> 
> 
> Cheers
> Don
> 
> 
> "Steve" <sspatriots@yahoo.com> wrote in message
> news:6d6936c7.0409140716.fc45ee4@posting.google.com...
> > I'm having problems coming up with a macro that will allow me to
> > import a text file of choice from my default file location that I have
> > set up with Excel which contains several text files.  I want the macro
> > to open a "Open" file dialog window where I can then choose the text
> > file of choice.  I also need it to open the file as delimited,
> > starting at row 23 and with the tab selected as the only delimiter.
> > Please help...
> >
> >
> > thanks,
> >
> > steve
0
sspatriots (78)
9/15/2004 1:04:02 PM
Reply:

Similar Artilces:

Find and Replace Footnote Numbering
I often have documents where I need to put formatting before or after the footnote number for every footnote, often for hundreds of footnotes...anyone know how I can do this in one shot? I know I can specify ^f in find and replace, but only in the find portion...it gives an error if you put it in replace. ...

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 ...

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...

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...

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...

Formula without using numbers after decimal in the answer
I have a formula that derives the answer from a figure with a decimal. I don't want to use the figures after the decimal. Is there a way to just use the whole number and omit the numbers after the decimal without having to manually key in all these numbers manually? Thanks, Mustang You can use the INT function. This 'rounds down' any number to th nearest integer, e.g. if A1=2.567, a formula in B2 of =INT(A1) return 2 HTH Bruc -- swatsp0 ----------------------------------------------------------------------- swatsp0p's Profile: http://www.excelforum.com/member.php?...

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 ...

Need Help, Task Start Date is wrong
I’m using MS Project 2007, have several task linked with finish to start. I have set date to schedule from, hours per day set to 8 and Working Monday thru Friday. My schedule shows Task 1 Duration 4 days, start Wed 6/2/10, Finish Mon 6/7/10 Task 2 Duration 3 days, start Mon 6/7/10, Finish Thu 6/10/10 Task 2 should have a Start Date of 6/8/10 not 6/7/10; what is causing this? Thanks in advance for your help. ...

how to convert lookup values to the "display text"
I'm using an sql code (below) which uses a few lookup fields. Unfortunately in the datasheet view, I get the "bound values" instead of the "display values". How can I change the properties for the these lookup fields so I can see the "display values" from the datasheet view? SELECT [Funding],[Date],[Description],[Company],[Expense_Type],[Amount],[Status] FROM [Form_9_Status] UNION ALL SELECT [Funding],[Date],[Description],[Company],[Expense_Type],[Amount],[Status] FROM [TDY_Status] UNION ALL SELECT [Funding],[Date],[Description],[C...

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....

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...

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 ...

RMS V2 and QSC Import
I have successfully imported several of my customers products using the QSC Import tool as a test but am unable to import the items with any association with sales tax? The default Sales Tax is TAX which is what I plan on using but once imported it creates a new item code TAX so now I have two? I plan on importing several hundred products and any help would be much appreciated. -Jess Reference- https://mbs.microsoft.com/partnersource/products/rms/downloads/releases/rms_so_importutility.htm i use the same tool but i dont tell the import utility anything about tax. import the items witho...

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...

random number generator
Hey is there a way to generate random numbers like you would for a draft. In other words, i have numbers 1 through 10 and generate a random order for those? Use the RAND() function. If 1-10 are in A1:A10, enter =RAND() in cell B1 and copy it down through B10. Recalc (F9), then sort by column B. Hope this helps, Hutch "pat67" wrote: > Hey is there a way to generate random numbers like you would for a > draft. In other words, i have numbers 1 through 10 and generate a > random order for those? > . > You would have to generate 10 random numbers ...

I need a macro
I would like a macro to do the following: I would place the the cursor in any cell and this macro would give me the average of all the entries to the left if the selected cell. EX: I place the cursor in cell M12. I want this macro on display in cell M12 the average of all the values from Col C12 to Col L12. Note that there may NOT be entries in all the cells in that range. Also the start point would always be col C .Thanks You can do this easily with a worksheet_selection event in the sheet module but you would probably want to restrict to a certain range or columns and rows or it woul...

print multiple pages on one sheet of paper
I am using mailmerge in Publisher to create placecards for a party we are hosting. The final size of the placecards is 1.5" by 1.5" and we have to print 100 final cards. Publisher gives me the option of printing multiple copies of the same page on one sheet of letter sized paper or one page on one sheet of letter sized paper. What I would like to do, however, is print multiple different pages on one sheet of paper. If I cannot find a solution for this, I will need to print 100 separate pages with a 1.5" square box of copy in the center of each sheet. In page setup, sel...

Moving incoming mail automatically to specific folders.
I have three separate E-Mail Accounts (1,2, and 3) I have created three subfolders under Inbox (Mail1, Mail2, Mail3) How can I automatically get the mail sent to the correct Mail in location (Mail1,Mail2 or Mail3). I am sure the answer like everything is easy when you know how but I have just spent an hour trying! Thanks Ted On Mon, 2 Jan 2006 00:24:44 -0000, "EddyStone" <teds@screaming.net> wrote: >I have three separate E-Mail Accounts (1,2, and 3) >I have created three subfolders under Inbox (Mail1, Mail2, Mail3) >How can I automatically get the mail sent to ...

Show date, time & day of week in one cell
Can I show the date, time and day of week in one cell. I have: 09/03/07 8:30 AM in one cell using the format (Format/Cells/Custom): [$-409]mm/dd/yy h:mm AM/PM;@ Excel refuses to accept ddd for Mon or dddd Monday at the end of the format I want it to read: 09/03/07 8:30 AM Monday in 1 cell. I have Excel 2003. One way: mm/dd/yy h:mm AM/PM dddd;@ In article <Xns99B8A3CAF9130pencilunlistedcom@208.49.82.220>, Burp <burp@beep.comINVALID> wrote: > Can I show the date, time and day of week in one cell. > > I have: > 09/03/07 8:30 AM > in one cell using the for...

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...

How do I overlay text to a row without loosing the text in the ba.
I would like to know how to give an entire row (or column) a text overlay such as "VOID" and still be able to view the text in the underlaying row (or column). Thanks in advance. Use WordArt from the Drawing toolbar. Change the Fill to None. -- Jim Rech Excel MVP "Bruce Charles" <Bruce Charles@discussions.microsoft.com> wrote in message news:C430F6BC-1EBD-461F-A3FA-EC8592C5704C@microsoft.com... |I would like to know how to give an entire row (or column) a text overlay | such as "VOID" and still be able to view the text in the underlaying row (or | c...

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...

Converting Formula into Numbers?
With a cell/s selected is there a way to convert the cell's formula into straight numbers (in turn removing all formula and leaving the same number)? -- Emp-Designer ------------------------------------------------------------------------ Emp-Designer's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=37564 View this thread: http://www.excelforum.com/showthread.php?threadid=571948 Emp-Designer a �crit : > With a cell/s selected is there a way to convert the cell's formula into > straight numbers (in turn removing all formula and leaving the same &...

I need to print a word in PDF from excel.
Hi, In my excel Macro, I update several values and then open a word linked with that excel. Finally what I need to do is to print that word to PDF. I already have a PDF Printer, so I just need the code to do it. Can anybody help me? Thanks in advance. Gast=F3n. Habilita la impresora predeterminada como la PDF y ya lo puedes imprimir a al formato deseado Gracias Francisco,=20 Tienes alg=FAn codigo para ello? gracias Repitiendo: Desde el panel de impresoras asigno primero la que me interesa y despues ejecuto mi macro desde el archivo excel asignando la instruccion sig: midefaultes = a...