How to print comments when use Track Markup feature in Visio – Office

Microsoft Technical Article






Printing Reviewer Comments in Legacy Visio Versions

🚀 Overview: Enabling Comment Visibility for Visio Printouts

In legacy versions of Microsoft Visio—specifically Visio 2003, 2007, and 2010—the “Track Markup” feature serves as a vital tool for collaborative reviews. It allows stakeholders to suggest modifications through “markup,” which encompasses ink shapes, geometric changes, and text-based comments. However, a known functional limitation exists: while these annotations are visible within the application workspace, reviewer comments are excluded by default when the document is sent to a printer or exported.

To address this, IT administrators can utilize a custom Visual Basic for Applications (VBA) macro. This script programmatically scans the document’s metadata, extracts the hidden annotation data, and consolidates it into a printable text shape. This ensures that all reviewer feedback is preserved in the physical or PDF output of the architectural or technical drawing.

⚙️ Key Technical Details

The solution relies on accessing the visSectionAnnotation and visSectionReviewer sections of the Visio ShapeSheet and DocumentSheet. The macro automates the collection of reviewer initials, timestamps, and the specific string content of each comment.

💻 The VBA Macro Solution

Microsoft provides the following programmatic example for administrative use. This script iterates through all markup pages associated with the active drawing, compiles the data, and generates a new rectangular shape containing the full audit trail of comments.

Public Sub GetComments()
Dim pagMarkup As Visio.Page
Dim pag As Visio.Page
Dim shp As Visio.Shape
Dim sText As String
Dim iRow As Integer

Set pag = Visio.ActivePage
sText = "Reviewer" & vbTab & "Date" & vbTab & "Comment"

If pag.PageSheet.SectionExists(Visio.visSectionAnnotation, Visio.visExistsAnywhere) Then
For iRow = 0 To pag.PageSheet.RowCount(Visio.visSectionAnnotation) - 1
sText = sText & vbCrLf & pag.Document.DocumentSheet.CellsSRC(Visio.visSectionReviewer, pag.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationReviewerID).ResultIU - 1, Visio.visReviewerInitials).ResultStr("")
sText = sText & pag.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationMarkerIndex).ResultIU
sText = sText & vbTab & Format(pag.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationDate).ResultIU, "ddddd")
sText = sText & vbTab & pag.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationComment).ResultStr("")
Next iRow
End If

For Each pagMarkup In pag.Document.Pages
If pagMarkup.Type = visTypeMarkup Then
If pagMarkup.OriginalPage = pag Then
If pagMarkup.PageSheet.SectionExists(Visio.visSectionAnnotation, Visio.visExistsAnywhere) Then
sText = sText & vbCrLf
sText = sText & vbCrLf & pag.Document.DocumentSheet.CellsSRC(Visio.visSectionReviewer, pagMarkup.ReviewerID - 1, Visio.visReviewerName).ResultStr("")
For iRow = 0 To pagMarkup.PageSheet.RowCount(Visio.visSectionAnnotation) - 1
sText = sText & vbCrLf & pag.Document.DocumentSheet.CellsSRC(Visio.visSectionReviewer, pagMarkup.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationReviewerID).ResultIU - 1, Visio.visReviewerInitials).ResultStr("")
sText = sText & pagMarkup.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationMarkerIndex).ResultIU
sText = sText & vbTab & Format(pagMarkup.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationDate).ResultIU, "ddddd")
sText = sText & vbTab & pagMarkup.PageSheet.CellsSRC(Visio.visSectionAnnotation, iRow, Visio.visAnnotationComment).ResultStr("")
Next iRow
End If
End If
End If
Next pagMarkup

Dim iAutoSize as Integer 'new
iAutoSize = pag.AutoSize 'new
pag.AutoSize = 0 'new
Set shp = pag.DrawRectangle(-pag.PageSheet.Cells("PageWidth").ResultIU, 0, 0, pag.PageSheet.Cells("PageHeight").ResultIU)
pag.AutoSize = iAutoSize 'new
shp.AddSection visSectionUser 'new
shp.AddNamedRow visSectionUser, "msvNoAutoSize", visTagDefault 'new
shp.CellsU("User.msvNoAutoSize").FormulaU = 1 'new
shp.Cells("Para.HorzAlign").Formula = "0"
shp.Cells("VerticalAlign").Formula = "0"
shp.Name = "Reviewers Comments"
shp.Text = sText
End Sub

📝 Implementation Steps

  • Step 1: Environment Setup – Launch Visio and open the target document. Initiate the Visual Basic Editor by pressing ALT+F11.
  • Step 2: Module Injection – Navigate to the Insert menu and select Module. Paste the code block provided above into the editor window. Save the project and return to the main Visio interface.
  • Step 3: Macro Execution – Go to the Tools menu, select Macros, and choose the newly created GetComments routine. Upon running, the macro generates a new shape containing the compiled comments.
  • Step 4: Final Placement – The macro initially places the comment shape outside the primary drawing border (to the left). Admins or users should resize this shape and drag it onto the active drawing page to ensure it is captured during the print process.

📊 Impact

🛡️ For Administrators: Implementing this macro reduces the overhead of manual transcription for review cycles. It provides a standardized way to ensure compliance and auditability in environments still utilizing legacy Visio versions.

⚠️ For Users: This workaround bridges the gap between digital collaboration and physical documentation. Users can now provide reviewers with printed evidence of their feedback, ensuring that proposed changes are not overlooked due to software-level printing omissions.

Read the full article on Microsoft.com