Pasting nicely formatted code into your blog
Thursday, February 5, 2004 at 12:08PM - Write the code in vs.net
- Paste it into a new word document
- Save the document as an html(filtered) (or .Text will have trouble with it)
- Close the doc , then re-open it without changing any text after that (this is an important step)
- Copy the code from the doc into your blog post
Sub FormatCodeForBlog()
Selection.PasteAndFormat(wdPasteDefault)
ActiveDocument.SaveAs(FileName:="temp.htm", FileFormat:=wdFormatFilteredHTML, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False)
ActiveWindow.View.Type = wdWebView
ActiveWindow.Close()
RecentFiles(1).Open()
Selection.WholeStory()
Selection.Copy()
End Sub
Blogging 




Reader Comments