title: Why does this VBA print out random garbage?
body: <p>Why does this VBA function print out random garbage <strong><em>at the end of the string</em></strong>?</p>
  
  <pre><code>Public Function GenGuid() As String
      Dim TypeLib As Object
      Dim Guid As String
      Set TypeLib = CreateObject("Scriptlet.TypeLib")
      Guid = TypeLib.Guid
      ' format is {24DD18D4-C902-497F-A64B-28B2FA741661}
      Guid = Replace(Guid, "{", "")
      Guid = Replace(Guid, "}", "")
      'Guid = Replace(Guid, "-", "")
      GenGuid = Guid
  End Function
  
  print genguid()
  816BF7CB-68B9-4D6B-855B-1273F22063DB 6
  print genguid()
  53664789-B0CD-422C-87B4-8928D93E5078  
  print genguid()
  FDD8ABDE-41F1-45E0-8330-9BA6161873BE i
  </code></pre>
  
  <h3>Reference</h3>
  
  <p><a href="http://office.microsoft.com/client/helppreview.aspx?AssetId=HV805572319990&amp;lcid=1033&amp;NS=EXCEL%2EDEV&amp;Version=12&amp;queryid=&amp;respos=1&amp;HelpID=vblr6%2Echm1008930" rel="nofollow">http://office.microsoft.com/client/helppreview.aspx?AssetId=HV805572319990&amp;lcid=1033&amp;NS=EXCEL%2EDEV&amp;Version=12&amp;queryid=&amp;respos=1&amp;HelpID=vblr6%2Echm1008930</a></p>
  
  <h3>Version</h3>
  
  <p>Excel 2007</p>