LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Three short questions regarding importing of data. See code

I have finished writing my program but need help in getting the data
into sheet2. In sheet1 a command button is supposed to have the user
select a file, have the data streamed to sheet2 and delimit it using
the comma.

My first question is how can I show just *.asc with this part of the
code:
Connection:= _ "TEXT;C:\data\meth\*.ASC",
When the open file window pops up it shows txt, then I have to select
asc file type. I want to show asc files the first time without having
to select the file type. Is there anyway to remove TEXT part?

My Second question, is it possible to arrange files by date and have
the last one highlighted without actually opening it ( there are
hundreds of files)

My third question, why does the VB give a run time error 1004 when if
for example your loading a file and you press cancel. Also happens
with my inputbox(). How can I prevent this?

Any help is appreciated. Thanks
Susan Hayes

I have the following code:

With Worksheets("data1").Activate

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\data\meth\*.ASC",
Destination:=Sheets("Data1").Range("A1") _
)
'.Name = "222003-M"
'.FieldNames = True
'.RowNumbers = False
'.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
'.SavePassword = False
'.SaveData = True
.AdjustColumnWidth = True
'.RefreshPeriod = 0
.TextFilePromptOnRefresh = True
'.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
'.TextFileTextQualifier = xlTextQualifierDoubleQuote
'.TextFileConsecutiveDelimiter = False
'.TextFileTabDelimiter = False
'.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
'.TextFileSpaceDelimiter = False
'.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
'.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False


End With
End With
 
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
Importing Data Questions Just enough knowledge to be dangerous Excel Discussion (Misc queries) 1 October 29th 07 10:59 AM
Importing Alan Beban's code on Arrays; Importing a module or a project Steve G Excel Worksheet Functions 4 August 27th 07 04:18 PM
Importing Uni Code (Big-Endian) Text data Qazi Imran Excel Discussion (Misc queries) 0 December 26th 06 09:14 AM
Short VB code for PasteValue slc[_4_] Excel Programming 5 November 18th 03 09:36 AM
4 short answer questions billabong Excel Programming 2 July 29th 03 05:08 AM


All times are GMT +1. The time now is 09:14 AM.

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"