Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

MS Word VBA to Format T-SQL Text as Rich Text

By K2mission,

This VBA script was written for MS Word. It formats the text and sets default colors for keywords. SQL 2005's Management Studio now does this by default but the previous Query Analyzer did not offer this functionality. This is useful if you prefer to print and review code from time to time (not recommended for printing all scripts due to the cost of color printing). All you have to do is create a macro/module and drop the code in. You can create a button on one of your menus to be able to quickly access it. The code also offers the best rendition of page formatting that I could come up with, considering that MS Word text differs slightly from Query Analyzer, as an option/prompt when running the code.

Total article views: 166 | Views in the last 30 days: 3
Related Articles

Printing Landscape

label printing, zebra s4m 200pdi, pdf, direct print


Printing SSRS Reports

Printing vis Browser


Print Setting and Issues

Print Setting and Issues


duplex printing

reporting service PDF prints both sides


database diagram print on one page

database diagram print


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones