Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hay any one help me in opening an existing txt files with a macro or
VBA coding. like i have differrent txt files in differrent file if open those file each txt file will be opened in one excel but i want all of them to be opened in the same excel file but in differrent sheets. and one more thing if we open a text file in excel it will ask us for the coulumn and row breaks i want to skip that as my default delimitar is a space thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you have to open them separately, but after you open the second one,
just move it the same workbook as the first. The last line in this code performs the move: Sub sbTwoTextFiles() 'dimension variables Dim wsDest As Worksheet 'open first text file Workbooks.OpenText Filename:="C:\text1.txt", StartRow:=1, _ DataType:=xlDelimited, ConsecutiveDelimiter _ :=False, Tab:=False, Semicolon:=False, Comma:=False, Space:=True 'set worksheet variable to first text sheet Set wsDest = ActiveSheet 'open second text file Workbooks.OpenText Filename:="C:\text2.txt", StartRow:=1, _ DataType:=xlDelimited, ConsecutiveDelimiter:=False, Tab:=False, _ Semicolon:=False, Comma:=False, Space:=True 'move text file to sheet after first text file ActiveSheet.Move After:=wsDest End Sub "ramki" wrote: hay any one help me in opening an existing txt files with a macro or VBA coding. like i have differrent txt files in differrent file if open those file each txt file will be opened in one excel but i want all of them to be opened in the same excel file but in differrent sheets. and one more thing if we open a text file in excel it will ask us for the coulumn and row breaks i want to skip that as my default delimitar is a space thank you |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() What kind of text file? Flat ascii (all of the records and fields run together), CSV (comma separated values -- not necessarily commas, it could be tabs, periods, quotes, etc.) or some other format? It matters because it determines the options you have to import data into Excel. Whereas text files have to be "imported". -- bgeier ------------------------------------------------------------------------ bgeier's Profile: http://www.excelforum.com/member.php...o&userid=12822 View this thread: http://www.excelforum.com/showthread...hreadid=543616 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
it is a plain text file which contains numbers seperated by tabs in the
coulumns. give me a reply |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
opening new csv file in existing xls file's worksheet | Excel Worksheet Functions | |||
on opening an existing file I get blank blue screen | Excel Worksheet Functions | |||
Excel 2007 blank when opening existing file | Excel Discussion (Misc queries) | |||
opening an existing file | Excel Discussion (Misc queries) | |||
Opening an existing Word File from within Excel | Excel Programming |