VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "WEBUtl" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Option Explicit Private Indent As String Private lFontFace As String Private lWebPage As String Private Q As String * 1 Private RequestString As String Private IAmADll As Boolean Public Property Let FontFace(ByVal NewFontFace As String) lFontFace = NewFontFace End Property Public Sub AppendRequest(st) 'appends st to the saved request string RequestString = RequestString + st End Sub Public Sub BodyEnd() 'Writes page body end to WEBPage Call WPage("") End Sub Public Sub BodyStart(Color) 'Writes body start, with Color specification, to WEBPage 'EX: If Color = "" Then Call WPage("") Else Call WPage("") End If End Sub Public Function Button(Name, Caption, ToolTip) As String 'Returns Button defined by Name and Caption Dim s As String 'EX: s = "" Button = s End Function Public Function Bold(Content) 'Returns Content as bold text 'EX: Content Bold = "" + Content + "" End Function Private Function Encl(s) If InStr(s, " ") + InStr(s, ",") <> 0 Or s = "" Then Encl = Q + s + Q Else Encl = s End If End Function Public Function ITALIC(Content) 'Returns Content as ITALIC text 'EX: Content ITALIC = "" + Content + "" End Function Public Function LineEnd() 'Returns vbCrLf + current Indent LineEnd = vbCrLf + Indent End Function Public Function CBox(Name, value, Checked, ToolTip) As String 'Returns CheckBox defined by Name, Value, and Checked Dim s 'EX: s = " "" Then s = s + " name=" + Encl(Name) If value <> "" Then s = s + " value=" + Encl(value) If Checked Then s = s + " checked" If ToolTip <> "" Then s = s + " title=" + Encl(ToolTip) CBox = s + ">" End Function Public Sub Cell(Align, iRowSpan, iColSpan, Width, Color, Content) 'Adds Cell defined by Align, Span, Color and Content to WEBPage Dim s As String 'EX: s = " "" Then s = s + " align=" + Encl(Align) If Width <> "" Then s = s + " width=" + Encl(Width) If iRowSpan > 1 Then s = s + " rowSpan=" + Encl(Format$(iRowSpan, "#")) If iColSpan > 1 Then s = s + " colSpan=" + Encl(Format$(iColSpan, "#")) s = s + Color + ">" If Trim(Content) = "" Then s = s + " " Else s = s + Trim(Content) s = s + "" Call WPage(s) End Sub Function ChangeChar(s As String, C1 As String, C2 As String) As String 'Change all occurances of C1 with C2 in the string S. Dim ans As String 'result string Dim l As Long 'position of C1 in Lcl Dim Lcl As String 'internal copy of S Lcl = s If Lcl <> "" Then l = InStr(Lcl, C1) Else l = 0 End If While l <> 0 ans = ans + Left$(Lcl, l - 1) + C2 Lcl = Right$(Lcl, Len(Lcl) - (l - 1 + Len(C1))) l = InStr(Lcl, C1) Wend ChangeChar = ans + Lcl End Function Public Sub ClearWebPage() 'Clear WEBPage of its contents lWebPage = "" Indent = "" End Sub Public Function Color(ForeColor, BackColor) As String 'Returns Color defined by ForeColor and BackColor Dim s As String s = "" If ForeColor <> "" Then s = s + " color=" + Encl(ForeColor) If BackColor <> "" Then s = s + " bgcolor=" + Encl(BackColor) Color = s End Function Public Function Font(iFontSize, FontFace, FontColor, Content) As String 'Returns Font defined by Fontsize, FontFace, Color, and Content Dim s As String Dim T As String 'EX: {size=iFontSize} {face=FontFace} {color=FontColor}Content If Trim(Content) = "" Then Font = "" Exit Function End If s = " 0 Then s = s + " size=" + Encl(Format$(iFontSize, "#")) If FontFace <> "" Then s = s + " face=" + Encl(FontFace) ElseIf lFontFace <> "" Then s = s + " face=" + Encl(lFontFace) End If If FontColor <> "" Then s = s + " color=" + Encl(FontColor) If Trim(Content) = "" Then T = " " Else T = Trim(Content) s = s + ">" + T + "" Font = s End Function Public Sub FormEnd() 'Adds Form end code to WEBPage Indent = Left$(Indent, Len(Indent) - 2) Call WPage("") End Sub Public Sub FormStart(ActionFileName, FormName) 'Adds Form start code to WEBPage 'EX:
Call WPage("") Indent = Indent + " " End Sub Public Function HBox(Name, value) As String 'Returns HiddenBox defined by Name and Value 'EX: Dim s s = " "" Then s = s + " name=" + Encl(Name) If value <> "" Then s = s + " value=" + Encl(value) HBox = s End Function Public Function HRef(URL, Content) 'Returns hot link to URL with specified content HRef = "" + Content + "" End Function Public Sub Header(Title) 'Writes page header with Title to WEBPage Call WPage("") Call WPage("") Call WPage("" + Title + "") Call WPage("") End Sub Public Function SelectOption(value, txt, selected) Dim s As String 'EX: