Sinister Beard
Sinister Beard

Reputation: 3680

Is there a shorter way of appending information to an existing string?

Is there a shorter way of appending information to an existing string in 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

Answers (2)

rekire
rekire

Reputation: 47945

No sorry this is not possible.

With you can use the operator &=. But it is not available in and not in VBA.

Upvotes: 3

KFleschner
KFleschner

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

Related Questions