title: How to modify text in Powerpoint via Excel VBA without changing style
body: <p>I am trying to replace a set of tags in the text of a powerpoint slide from Excel using VBA.  I can get the slide text as follows:</p>
  
  <pre><code>Dim txt as String
  txt = pptSlide.Shapes(jj).TextFrame.TextRange.Characters.text
  </code></pre>
  
  <p>I then run through replacing my tags with the requested values.  However when I set do </p>
  
  <pre><code>pptSlide.Shapes(jj).TextFrame.TextRange.Characters.text = txt
  </code></pre>
  
  <p>Problem: All the formatting which the user has set up in the text box is lost.</p>
  
  <p>Background:
  The shape object is msoPlaceHolder and contains a range of text styles including bullet points with tags which should be replaced with numbers for instance.  The VBA should be unaware of this formatting and need only concern itself with the text replacement.</p>
  
  <p>Can anyone tell me on how to modify the text while keeping the style set up by the user.</p>
  
  <p>Thanks.</p>
  
  <p>Am using Office 2010 if that is helpful.</p>