I'm trying to do string formatting using vba. What I'm trying to do is use productId
within payload
. It seems I'm close but I can't make it the way I need it.
I've tried with:
Sub modifyParams()
Dim Payload$, productId$
productId = "6000196167258"
Payload = "{""fsa"":""L5V"",""products"":[{""productId"":" & productId & ",""skuIds"":[""6000196167259""]}],""lang"":""en"",""pricingStoreId"":""1061"",""fulfillmentStoreId"":""1061"",""experience"":""whiteGM""}"
MsgBox Payload
End Sub
This is what it prints:
However, I wish to get quotation mark " around productId, which is missing here.
How can I put quotation mark around an id using string formatting?
You need to use double double quotes, like you have in other places, before and after the & productId &
section.
Payload = "{""fsa"":""L5V"",""products"":[{""productId"":""" & productId & """,""skuIds"":[""6000196167259""]}],""lang"":""en"",""pricingStoreId"":""1061"",""fulfillmentStoreId"":""1061"",""experience"":""whiteGM""}"