Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Import Text file

Hi

Im trying to couple GetOpenFilname with Import Text file wizard.
i.e.
Open a folder, select a text file, and import into an ActiveSheet in tab
delimited form, Treating consecutive delimiters as one.

--
Thank you

Regards
Aussie Bob C.
Using Windows XP Home + Office 2003 Pro
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Import Text file

After you get the file's name with GetOpenFilename use the OpenText method
to open it.

--
Jim Rech
Excel MVP
"Robert Christie" wrote in message
...
| Hi
|
| I'm trying to couple "GetOpenFilname" with "Import" Text file wizard.
| i.e.
| Open a folder, select a text file, and import into an ActiveSheet in tab
| delimited form, Treating consecutive delimiters as one.
|
| --
| Thank you
|
| Regards
| Aussie Bob C.
| Using Windows XP Home + Office 2003 Pro


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Import Text file

Hi Jim
Help says OpenText Method opens file in a new Workbook. I need to open in
Active Worksheet Cell A1.

TIA

Regards,
Aussie Bob C.

"Jim Rech" wrote:

After you get the file's name with GetOpenFilename use the OpenText method
to open it.

--
Jim Rech
Excel MVP
"Robert Christie" wrote in message
...
| Hi
|
| I'm trying to couple "GetOpenFilname" with "Import" Text file wizard.
| i.e.
| Open a folder, select a text file, and import into an ActiveSheet in tab
| delimited form, Treating consecutive delimiters as one.
|
| --
| Thank you
|
| Regards
| Aussie Bob C.
| Using Windows XP Home + Office 2003 Pro



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Import Text file

Hi

Just for general interest this snippet of code works ok for me:

ChDir "C:\Data\Excel\School 2005\"
MyDataFile = Application.GetOpenFilename("Text Files,*.Txt")
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & MyDataFile, _
Destination:=Range("A1"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

Assuie Bob C.

"Robert Christie" wrote:

Hi Jim
Help says OpenText Method opens file in a new Workbook. I need to open in
Active Worksheet Cell A1.

TIA

Regards,
Aussie Bob C.

"Jim Rech" wrote:

After you get the file's name with GetOpenFilename use the OpenText method
to open it.

--
Jim Rech
Excel MVP
"Robert Christie" wrote in message
...
| Hi
|
| I'm trying to couple "GetOpenFilname" with "Import" Text file wizard.
| i.e.
| Open a folder, select a text file, and import into an ActiveSheet in tab
| delimited form, Treating consecutive delimiters as one.
|
| --
| Thank you
|
| Regards
| Aussie Bob C.
| Using Windows XP Home + Office 2003 Pro



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I import text file of cash flow to excel file then use formula Bumpa Excel Discussion (Misc queries) 2 May 28th 10 04:22 PM
Set Defaults in File Import of a Text File Dkline Excel Worksheet Functions 2 January 28th 08 06:20 PM
Would Like to Automate Batch File Creation and Text FIle Import socrtwo Excel Discussion (Misc queries) 2 August 18th 06 03:54 PM
Import text file into excel with preset file layout, delimeters VBA meldrape Excel Programming 7 June 15th 04 08:31 PM
Get External Data, Import Text File, File name problem Scott Riddle Excel Programming 1 July 11th 03 05:40 PM


All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"