How to Use Chip Pearson's Text Import Code
Glad you got it working.
socrtwo wrote:
Dave Peterson wrote:
I would think that using excel's import features would be quicker.
But you may want to look at using application.trim() against the input record.
whateverthevariableisfortheinputrecord _
= application.trim(whateverthevariableisfortheinputr ecord)
It will remove any leading/trailing or multiple embedded spaces from a string.
Yes that solved the problem. I added
WholeLine = Application.Trim(WholeLine)
after Chip Pearson's lines
While Not EOF(1)
Line Input #1, WholeLine
It removed the extraneous spaces. I'm excited.
Also I was able to get the text insert to move to the next blank line
for each subsequest file insert, by adding:
ActiveCell.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
under your code of:
MsgBox myFileName & " wasn't found!"
Else
ImportTextFile myFileName, ";"
This is my first VBA script, and you got me through it. Thanks for the
help!
--
Dave Peterson
|