ASP Q&A: Commenting Blocks in VBScript | CodeGuru

ASP Q&A: Commenting Blocks in VBScript

This is the third in a series of tips being posted based on the most read posts in one of our ASP Forums. (previous Q&A) Problem / Question: How can a whole block of VBScript be commented out? Solution: Unfortunately, you cannot block comment VBScript like you can in other languages. You can comment out […]

Written By
CodeGuru Staff
CodeGuru Staff
Sep 29, 2016
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

This is the third in a series of tips being posted based on the most read posts in one of our ASP Forums. (previous Q&A)

Problem / Question:

How can a whole block of VBScript be commented out?

Solution:

Unfortunately, you cannot block comment VBScript like you can in other languages. You can comment out each line individually. Just put a single quotation mark at the start of the line you want to ‘out’ and do then do the same for each subsequent line.

The following shows a sample code listing with a block of code commented:

Dim a, iLen, bSpace, tmpX, tmpFull

iLen = Len(sText)
  For a = 1 To iLen
'    If a <> 1 Then
'        If bSpace = True Then
'            tmpX = UCase(mid(sText,a,1))
'            bSpace = False
'        Else
'        tmpX=LCase(mid(sText,a,1))
'            If tmpX = " " Or tmpX = "'" Then bSpace = True
'        End if
'    Else
'        tmpX = UCase(mid(sText,a,1))
'    End if 

   tmpFull = tmpFull & tmpX
  Next
  ProperCase = tmpFull
End Function

Based on posts by forum members Lydia, Scotty, and Xanderno

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.