Problem
I am working with some Excel slicers through VBA, and need to filter (a varying number of) items at the same time.
The slicer commands include the """ and "&" characters, however, which obviously is problematic.
I've tried treating the """ and "&" characters individually, e.g. "Some text" & """ & str1 & "&" & "more text"
, as well as trying to bundle it all together, e.g. "Some text"" & str1 & "&more text"
Neither approach seems to work, generating a "Compile error: Expected: End of statement".
Question
Is there a better way to include the "&" and """ characters in a concatenation?
More Context
This is the actual string layout I am trying to end up with, after all concatenation is complete:
"[Jobs].[ParentJob].&[Code1]", "[Jobs].[ParentJob].&[Code2]", "[Jobs].[ParentJob].&[Code3]"
Where Jobs and ParentJob remain the same (they are slicer categories and should be part of the string); but Code1, Code2 etc... are variables which are to be concatenated one by one as a loop runs.
I'm confident running the loop and concatenating the right parts in the right places, I just can't find any resources anywhere that explain how to include " and & in concatenations when they are in a more complex format.