LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Macro to Import Text

I am working on creating a macro that takes text data and import it into an
existing worksheet. To do this, I normally use the Import Data wizard.
Since I do this several times a day, I am trying to create a macro that will
allow me to select the text file (while I have my worksheet open) and then
select a cell placement for the data once the text files is created. I have
most of the code created, but cannot get it to pause at the file open dialog
box or the cell range box. Are there specific codes I need to use to get
this macro to do this? files into Excel
from Word several times a day.

With ActiveSheet.QueryTables.Add(Connection:="Text Files (*.txt), *.txt", _
Destination:=Range("A2"))
.Name = "subcount"
.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 = xlTextQualifierNone
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = "|"
.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)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub


 
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
Stop excel from dropping the 0 in the beginning of a number? Rosewood Setting up and Configuration of Excel 12 April 4th 23 02:12 PM
how do I email amacro? leo Excel Worksheet Functions 24 August 9th 06 02:47 PM
How to import plain text into workable tables/cells? Xane Excel Discussion (Misc queries) 2 November 11th 05 01:02 AM
In Excel need macro to tell if Text Box is Blank or has Text Jerry Dyben Excel Discussion (Misc queries) 1 September 28th 05 04:07 AM
How do I change macro text with another macro? Eric Excel Discussion (Misc queries) 4 April 27th 05 11:20 PM


All times are GMT +1. The time now is 02:35 AM.

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

About Us

"It's about Microsoft Excel"