Nick Vittum wrote:......What does "vbLf" represent here? Perhaps that's my clue.
Don’t be side tracked by the "
vbLf". Its use here is just part of the interesting way to use a message box. ( I also picked that up from snb, as I recall ).
The answer is at the web site, but you will probably need to get a bit familiar first with string functions like
Split and
Join, so that you don’t get side tracked by them.
( Those 2 things also play a part often in the interesting way to use a message box, ( at least if you try to use compact clever "snb" type coding ) )
Unfortunately as you try to learn VBA you get side tracked in infinite directions because there is so much to learn.
Just a bit off topic to the "vbLf"
As far as I know, a long time ago we had simple computers and a lot of big printers laying around. Inside the string that was sent to the printer we often had a couple of extra “invisible” characters to make the next text bit start on a new line: . One returned the typing carriage bit back to the left/start, & the other clicked the spindle up to feed a line of paper.
Those two characters got kept for compatibility for indicating a new line, generally, in text.
In VBA we usually represent the two things as
vbCr & vbLf ... ( "vb carriage return" & "vb line feed" )
But over the years the convention used has got a bit inconsistent.
Sometimes, for a new line, a
vbCr & vbLf is used , sometimes
vbCr , sometimes
vbLf. ( Don’t be fooled into thinking that there is as forth or fifth , like
vbNewLine or
vbCrLf– those things exist, but as far as I can tell they are both seen / interpreted as just the 2 characters,
vbCr & vbLf )
(
vbNewLine or
vbCrLf = 2 characters,
vbCr & vbLf )
vbLf is most often used conventionally in Excel, in cells for example to split a line – try this: write a bit of text in a cell , click in the middle of the text, hit
Alt+Enter . The text gets split into two lines ( you might have to adjust the cell height to see the two lines ) . If you were to now analyse the composition of that string text in the cell, you would find that a single
vbLf character has been added at the point you clicked on before doing the
Alt+Enter
Often you can use either of the three ways. Either will do the same in a cell, the immediate window, or in a message box – try it on snb’s example – I think it makes no difference to the results
You occasionally see quirks and awkward compatibility problems arising due to the different conventions used. The result is that lines get joined up or you get extra unwanted empty lines appearing unexpectedly when , for example copying and pasting text from one place to another.
Alan
Ref
String stuff: https://www.excelforum.com/word-program ... ost4590792" onclick="window.open(this.href);return false;
https://docs.microsoft.com/en-us/dotnet ... -functions" onclick="window.open(this.href);return false;
vbCr VbLf: http://eileenslounge.com/viewtopic.php?f=18&t=33834" onclick="window.open(this.href);return false;
http://www.excelfox.com/forum/showthrea ... f-a-string" onclick="window.open(this.href);return false;
https://excelribbon.tips.net/T010741_Re ... paces.html" onclick="window.open(this.href);return false; ( Comments : 2020-02-24 09:17:40 , 2020-02-26 07:32:03 )
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also