ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA - Error Using Mid To Parse A Data (.dat) File (https://www.excelbanter.com/excel-programming/362018-vba-error-using-mid-parse-data-dat-file.html)

ajocius[_56_]

VBA - Error Using Mid To Parse A Data (.dat) File
 

Group,
Recently I found a thread to parse a data file. The guts of the
operation uses a statement called Mid. I have a data file that has
data that is comma separated and when opened manually in Excel and
converted via Text To Columns it looks fine. Using the Open command
and single stepping down to Mid I get to the end of the of the first
line I get an error message. There is a non-alphanumeric character
between the last character of the first line of data and the first
character in the second line of data. This I believe is causing all my
problems. Is there a way to skip this special character?

Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695
View this thread: http://www.excelforum.com/showthread...hreadid=544096


Tom Ogilvy

VBA - Error Using Mid To Parse A Data (.dat) File
 
Mid should have no problem with any special characters.

Possibly the error is unrelated to MID. After the error, in the VBE, go to
Tools=References and see if you see a reference marked as MISSING. If so,
this is probably the source of the problem. You need to clear up this
missing reference.

You can also try using

VBA.Mid

if you want a band aid approach.

--
regards,
Tom Ogilvy

"ajocius" wrote in
message ...

Group,
Recently I found a thread to parse a data file. The guts of the
operation uses a statement called Mid. I have a data file that has
data that is comma separated and when opened manually in Excel and
converted via Text To Columns it looks fine. Using the Open command
and single stepping down to Mid I get to the end of the of the first
line I get an error message. There is a non-alphanumeric character
between the last character of the first line of data and the first
character in the second line of data. This I believe is causing all my
problems. Is there a way to skip this special character?

Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile:

http://www.excelforum.com/member.php...o&userid=17695
View this thread: http://www.excelforum.com/showthread...hreadid=544096




ajocius[_57_]

VBA - Error Using Mid To Parse A Data (.dat) File
 

Tom,
A million thanks. That was the problem, a logical problem. NextPos
wasn't resetting and I reset Pos and all is fine. Awesome. One I
realized it was a logic problem and single stepped into the problem, it
was as obvious as a semi-truck hitting a Yugo. Thanks again for your
help.

Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695
View this thread: http://www.excelforum.com/showthread...hreadid=544096



All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com