The other day I grew increasingly frustrated with the amount of code I could or rather couldn’t see on my screen at work, even when working in full screen mode. I therefore wanted to write a Visual Studio macro to zoom in and out of the text editor. However while browsing through the sample macros that come with Visual Studio 2008, I found two macros that are doing just what I wanted: DecreaseTextEditorFontSize and IncreaseTextEditorFontSize. To check whether they are installed on your machine, simply go to or type in ALT + F8 and then drill down to .
Here is the Visual Basic code (after I changed fontSizeIncrement from 2 to 1):
' Set the font size increment and minimum font size
Private Const fontSizeIncrement As Integer = 1
Private Const minimumSupportedEditorSize As Integer = 3
' Increases the font size used within the editor.
Public Sub IncreaseTextEditorFontSize()
Dim textEditorFontsAndColors As Properties
textEditorFontsAndColors = DTE.Properties(“FontsAndColors”, “TextEditor”)
textEditorFontsAndColors.Item(“FontSize”).Value += fontSizeIncrement
End Sub
' Decreases the font size used within the editor.
Public Sub DecreaseTextEditorFontSize()
Dim textEditorFontsAndColors As Properties
Dim fontSize As [Property]
textEditorFontsAndColors = DTE.Properties(“FontsAndColors”, “TextEditor”)
fontSize = textEditorFontsAndColors.Item(“FontSize”)
If fontSize.Value >= minimumSupportedEditorSize Then
fontSize.Value -= fontSizeIncrement
End If
End Sub
If you don’t have the Visual Studio samples, follow the steps below to add these two macros:
-
Open the Macro IDE ( or ALT + F11).
-
In Project Explorer, right-click on and select
-
In the dialog, choose , give it a name (e.g. MyModule) and click .
-
Simply copy and paste the code above in the newly added module.
-
Save and close the Macro IDE.

All I had to do after that was to bind these macros to a keyboard shortcut. I chose ALT + [ to decrease the text font size and ALT + ] to increase it.

Now, I can easily zoom code in and out in the Visual Studio Text Editor.