Getting a String into a Stream
Working on a demo using the Office 2007 XML File Formats Code Snippets that I worked on a while back, and needed to get a String value into a Stream--the snippet requires a Stream parameter, and I had a ribbon stored as a project resource (so I get it as a string). I tried several different techniques before I finally gave up and used code like this:
Imports System.Text
Dim stream As New MemoryStream( _
ASCIIEncoding.Default.GetBytes(My.Resources.CustomUI))
It feels ugly, but it appears to be the only real way to do it.