Skip to Main Content
Visual Studio Hacks
book

Visual Studio Hacks

by James Avery
March 2005
Intermediate to advanced content levelIntermediate to advanced
304 pages
19h 23m
English
O'Reilly Media, Inc.
Content preview from Visual Studio Hacks
Blog Code from Visual Studio #96
Chapter 13, Enhancing Visual Studio
|
435
HACK
document.ActiveWindow.Selection.WholeStory( )
' Copy it to the clipboard.
document.ActiveWindow.Selection.Copy( )
' Close the document.
document.Close( )
document = Nothing
application = Nothing
oleApplication = Nothing
' Cleanup after ourselves.
IO.File.Delete(path)
End Sub
End Module
After you have added and saved this macro, you can then select a piece of
text in the code editor and then double-click on this macro. You will see the
hourglass for a couple of moments, the macro has to open Microsoft Word,
which takes a few seconds. When the hourglass goes away, you will have the
formatted HTML code in your clipboard. You can then go to your favorite
blogging tool and paste the HTML directly into that tool. This macro works
by copying the code from Word. This means that, when you paste the code,
it has to be into an application that will understand the rich formatting. For
instance, pasting this into the design view of a
richtextbox will work per-
fectly; pasting into Notepad will not work.
Convert to HTML with an Add-in
Another way to get from code to HTML is through the use of a freely avail-
able add-in called CopySourceAsHTML. First, you will need to download
and install the add-in. It can be downloaded from http://www.jtleigh.com/
CopySourceAsHTML.
After downloading and installing the add-in, you will see a new item ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft Visual Studio 2015 Unleashed, Third Edition

Microsoft Visual Studio 2015 Unleashed, Third Edition

Mike Snell, Lars Powers
.Net Framework Essentials

.Net Framework Essentials

Thuan L. Thai, Hoang Lam
C# 5.0 Unleashed

C# 5.0 Unleashed

Bart De Smet
Programming .NET Security

Programming .NET Security

Adam Freeman, Allen Jones

Publisher Resources

ISBN: 0596008473Errata Page