Reputation: 3680
Is there a shorter way of appending information to an existing string in vba than:
strExample = strExample & "Lorem Ipsum"
I've got a lot of these when compiling dynamic strings, and it'd save time and look neater in my code if there was a shorter way of typing this.
Thanks
Upvotes: 1
Views: 1946
Reputation: 47945
No sorry this is not possible.
With vb.net you can use the operator &=
.
But it is not available in vbscript and not in VBA.
Upvotes: 3
Reputation: 499
You could set up a global string var and create a function to add on to just that string. It wouldn't save that much time coding, but it may be something that helps
Public strExample as String
Sub Main()
{do something}
AddTo("One")
{do something else}
AddTo("Two")
End Sub
Sub AddTo(str as String)
strExample = strExample & str
End Sub
Upvotes: 1