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?


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


  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date