Reputation: 7
I am writing a VBA
code , where I need to pass few variables inside double quotes.
Code as below
Set newrel = rels.AddWithRoleName("Entity1", "Entity1", 1," attr1,attr1_role; col1, col1_role")
Here, for "Entity1"
I can pass variables as there is only one values, but for the last parameters, "attr1,attr1_role; col1, col1_role"
, I need to pass 4 variables for these parameters.
As this is inside double quotes, it is not taking the values when I am passing the variable names.
Upvotes: 0
Views: 704
Reputation: 57683
If you have the following variables
attr1
attr1_role
col1
col1_role
and you want to pass them as a string like "attr1,attr1_role; col1, col1_role"
then you need to make a concatenated string with your variables:
attr1 & "," & attr1_role & "; " & col1 & ", " & col1_role
For example:
Dim Parameter4 As String
Parameter4 = attr1 & "," & attr1_role & "; " & col1 & ", " & col1_role
Set newrel = rels.AddWithRoleName(Entity1, Entity1, 1, Parameter4)
Make sure to use a more meaningful name than Parameter4
in your production environment.
Upvotes: 1