EddieNo2
EddieNo2

Reputation: 3

Unwanted Linebreak in VBA-Variable

I'm pretty much a newbie to VBA and Access and I start to get kinda frustrated.

I'm working on a program for calculating prizes and therefor I got HTML-Datas with the necessary informations which get split up as following:

strHTML = GetHTML(HTML)
List() = Split(strHTML, Chr(10))

Just to make it clear, the HTML lines I pick up for this look as following:

Motortyp=SM132
Motortypreihe=SM
MotorBG=132
MotorFE=35
MotorZusatz1=B
MotorZusatz2=
ReglerTyp=Fremdregler

So far so good. The whole gear description (e.g. "SM200.15C") is taken at once and somehow there still is kind of a line break afterwards which leads to me not being able to use it in queries as I want to.

It seems like the line break at which I split up the HTML somehow is still present and it just don't want to get replaced by stuff like Replace([Data], Chr(10). "").

Hope the question was Kind of understandable since I got a few brain lags today.

Thanks in advance, Dennis

Upvotes: 0

Views: 47

Answers (1)

Andy G
Andy G

Reputation: 19367

On Windows a newline is obtained from the combination of a carriage return Chr(13) and linefeed Chr(10) characters. Use

List() = Split(strHTML, vbCrLf)

where vbCrLf is a VB constant representing this pair of characters.

Upvotes: 1

Related Questions