title: Placing Double Quotes Within a String in VBA
body: <p>I'm having a hard time understanding how to place a double quote (") within a String in VBA. I know that I can easily do this using the <code>char(34)</code> function. I also understand that another way of doing this is to use 4 double quotes: <code>""""</code>. All of this comes from a previous SO post:</p>
  
  <p><a href="https://stackoverflow.com/questions/9024724/how-do-i-put-double-quotes-in-a-string-in-vba">How do I put double quotes in a string in vba?</a></p>
  
  <p>However, my question is.... Why are 4 quotes needed? Do the first two act as the escape, the third is the quote itself, and the fourth is the terminating quote? Or does it work in a different way? I haven't been able to find a concrete answer as to how VBA treats these double quotes. </p>
  
  <p>I've also noticed that if I try adding or removing the number of double quotes within a String, Visual Studio will dynamically add or remove double quotes. For example, I initially had the following String:</p>
  
  <pre><code>data = TGName + """ + iterator.Value + """
  </code></pre>
  
  <p>...which produces the following within a message box:</p>
  
  <p><a href="https://i.stack.imgur.com/RrkrS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RrkrS.jpg" alt="enter image description here"></a></p>
  
  <p>However, if I try adjusting the second set of double quotes at the end of the String (<code>+ """</code>) from 3 to 4, Visual Studio automatically adjusts this to 5. There's no way for me to only have 4 quotes at the end. This is the resulting String within a message box:</p>
  
  <p><a href="https://i.stack.imgur.com/XG00W.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XG00W.jpg" alt="enter image description here"></a></p>
  
  <p>The Strings within the message boxes aren't the actual output that I'm hoping to have, they're purely for experimental purposes. However, what I've noticed is that there clearly is a requirement for the number of quotes that are allowed within a String in VBA. Does anyone know what that requirement is? Why is the IDE forcefully inserting an additional quote in the second String? Can someone explain the differences between the actual String contents and the formatting quotes within both cases that I've described?</p>
  
  <p>As always, any assistance on this would be greatly appreciated :) </p>