Formatting Report - Formatting Text Files
Sub Aligning_Text_In_Variables()
' ---------------------------------------------------------------
' Written By Shanmuga Sundara Raman for http://vbadud.blogspot.com
' ---------------------------------------------------------------
' Aligment of Text in Reports is a pain.. that too if the report is a flat file
' Here are a couple of ways to align
Dim sCharBuff As String
Dim sName As String
Dim sAge As String
Dim sAdd As String
Dim sPrint As String
' Left Alignment
' Example
' Name :
' Age :
' Address :
sCharBuff = "123456789123456789" ' Just for length
sName = "Name"
sAge = "Age"
sAdd = "Address"
sPrint = sCharBuff
LSet sPrint = sName
Debug.Print sPrint & ":"
sPrint = sCharBuff
LSet sPrint = sAge
Debug.Print sPrint & ":"
sPrint = sCharBuff
LSet sPrint = sAdd
Debug.Print sPrint & ":"
' Right Alignment
' Example
' Name:
' Age:
' Address:
sCharBuff = "123456789123456789" ' Just for length
sName = "Name"
sAge = "Age"
sAdd = "Address"
sPrint = sCharBuff
RSet sPrint = sName
Debug.Print sPrint & ":"
sPrint = sCharBuff
RSet sPrint = sAge
Debug.Print sPrint & ":"
sPrint = sCharBuff
RSet sPrint = sAdd
Debug.Print sPrint & ":"
' ---------------------------------------------------------------
' Aligning Text Output in Variables
' ---------------------------------------------------------------
End Sub
Sunday, April 08, 2007
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.
No comments:
Post a Comment