THEO TODMAN’S WEBSITE CODE PAGES



This Page provides a jumping-off point for the VBA Code that generates my Website.

Table of Code Documentation Location 31 (10 items)

Form_OpenCount_BookPapersFunctor_19Functor_21
Functor_22Functor_23Number_FormatAeon_Authors_Add
CheckerJacks_Non_Prime..

To access information, click on one of the links in the table above.

Go to top of page




Source Code of: Aeon_Authors_Add
Procedure Type: Public Sub
Module: New Code
Lines of Code: 108
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Sub Aeon_Authors_Add()
0002Dim rs As Recordset
0003Dim rsAuthors As Recordset
0004Dim rsAuthor_Parameter As Recordset
0005Dim strQuery As String
0006Dim strAuthor As String
0007Dim strAuthor_Saved As String
0008Dim Author As String
0009Dim Author_Reformat As String
0010Dim i As Integer
0011Dim j As Integer
0012Dim k As Integer
0013Dim x As Integer
0014Dim strMessage As String
0015Dim Output_Authors As Boolean
0016Dim Output_Old_Authors As Boolean
0017 strMessage = "Get ready to output Authors pages? Usually wait to output until we've output the Aeon note with 'Refresh Links', but this will maintain the Author_Parameter table."
0018If MsgBox(strMessage, vbYesNo + vbDefaultButton1) = vbYes Then
0019 Output_Authors = True
0020 strMessage = "Add all relevant Authors pages, including newly-loaded ones, to Author_Parameter table?"
0021 If MsgBox(strMessage, vbYesNo + vbDefaultButton1) = vbYes Then
0022 Output_Old_Authors = True
0023 Else
0024 Output_Old_Authors = False
0025 End If
0026Else
0027 Output_Authors = False
0028 Output_Old_Authors = False
0029End If
0030strAuthor_Saved = ""
0031' Clear & ready Author_Parameter Table
0032 strQuery = "DELETE * FROM Author_Parameter;"
0033DoCmd.RunSQL (strQuery)
0034 strQuery = "SELECT * FROM Author_Parameter;"
0035Set rsAuthor_Parameter = CurrentDb.OpenRecordset(strQuery)
0036' Select Aeon_Files rows with Authors encoded
0037 strQuery = "SELECT Aeon_Files.Author_Names FROM Aeon_Files WHERE (((Aeon_Files.Author_Names) Like ""*+A*"")) ORDER BY Aeon_Files.Author_Names;"
0038Set rs = CurrentDb.OpenRecordset(strQuery)
0039rs.MoveFirst
0040Do Until rs.EOF
0041 strAuthor = rs.Fields(0)
0042 If strAuthor <> strAuthor_Saved Then
0043 'Find the authors
0044 i = 1
0045 j = 1
0046 Do Until j = 0
0047 j = InStr(i, strAuthor, "A+")
0048 If j > 0 Then
0049 Author = Mid(strAuthor, i + 2, j - i - 2)
0050 'Check if on Author's Table
0051 strQuery = "SELECT Authors.Author_Name, Authors.Author_Name_Display FROM Authors WHERE (((Authors.Author_Name)=""" & Author & """));"
0052 Set rsAuthors = CurrentDb.OpenRecordset(strQuery)
0053 If rsAuthors.EOF Then
0054 Debug.Print Author
0055 Author_Reformat = Author
0056 x = InStr(Author_Reformat, "(")
0057 If x > 0 Then
0058 k = InStr(x, Author_Reformat, ")")
0059 If k > 0 Then
0060 Author_Reformat = Mid(Author_Reformat, x + 1, k - x - 1) & " " & Trim(Left(Author_Reformat, x - 1))
0061 End If
0062 End If
0063 'Load to Author's table
0064 rsAuthors.AddNew
0065 rsAuthors.Fields(0) = Author
0066 rsAuthors.Fields(1) = Author_Reformat
0067 rsAuthors.Update
0068 Set rsAuthors = Nothing
0069 'Add to Author_Parameter Table, ready for output of the Author pages
0070 rsAuthor_Parameter.AddNew
0071 rsAuthor_Parameter.Fields(0) = Author
0072 rsAuthor_Parameter.Update
0073 Else
0074 If Output_Old_Authors = True Then
0075 'Add to Author_Parameter Table, ready for output of the Author pages (existing authors need to have their pages updated)
0076 rsAuthor_Parameter.AddNew
0077 rsAuthor_Parameter.Fields(0) = Author
0078 On Error Resume Next
0079 rsAuthor_Parameter.Update
0080 End If
0081 End If
0082 i = j
0083 i = InStr(i, strAuthor, "+A")
0084 If i = 0 Then
0085 j = 0
0086 End If
0087 End If
0088 Loop
0089 End If
0090 strAuthor_Saved = strAuthor
0091 rs.MoveNext
0092Loop
0093If Output_Authors = True Then
0094 strMessage = "Actually output the Authors pages? Usually wait until we've output the Aeon note with 'Refresh Links'."
0095 If MsgBox(strMessage, vbYesNo + vbDefaultButton2) = vbYes Then
0096 'Output the Author pages
0097 strDataQuery = "Authors_List_Selected_Authors"
0098 strControlTable = "Authors"
0099 strOutputFileShort = "Author"
0100 strOutputFolder = "C:\Theo's Files\Websites\Theo's Website\Authors\"
0101 strOutputFile = ""
0102 CreateAuthorsWebPages ("Regen")
0103 End If
0104End If
0105OK = MsgBox("Authors added OK at " & Now(), vbOKOnly)
0106Set rs = Nothing
0107Set rsAuthor_Parameter = Nothing
0108End Sub

Procedures Calling This Procedure (Aeon_Authors_Add) Procedures Called By This Procedure (Aeon_Authors_Add) Tables / Queries / Fragments Directly Used By This Procedure (Aeon_Authors_Add) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Checker
Procedure Type: Public Sub
Module: Testing
Lines of Code: 16

Line-No. / Ref.Code Line
0001Public Sub Checker()
0002Dim rs As Recordset
0003Dim i As Integer
0004Dim ifields As Integer
0005'Set rs = CurrentDb.OpenRecordset("TRANSFORM Sum([Year_Crosstab].[Hours ]) AS Hours SELECT Average_Plans.Project, Average_Plans.[Average This Qtr Plan] AS [Planned Weekly Hours], 0 AS [Planned QTD %age], Sum(0) AS [QTD Actual %], Round([Average YTD Plan],2) AS [Planned YTD %age], Sum(0) AS [YTD Actual %], Sum(0) AS [QTD Actual Hours], Sum(Year_Crosstab.Hours) AS [YTD Actual Hours] FROM Average_Plans LEFT JOIN Year_Crosstab ON Average_Plans.Project = Year_Crosstab.Group WHERE ((((Year_Crosstab.Period) >= ""2019-10"" And (Year_Crosstab.Period) <= ""2020-09"") Or (Year_Crosstab.Period) Is Null)) GROUP BY Average_Plans.Project, Average_Plans.[Average This Qtr Plan], Round([Average YTD Plan],2) ORDER BY Average_Plans.Project PIVOT Year_Crosstab.Period;")
0006 Set rs = CurrentDb.OpenRecordset("SELECT * FROM Project_Plans;")
0007rs.MoveFirst
0008ifields = rs.Fields.Count
0009Do Until rs.EOF
0010 For i = 0 To ifields - 1
0011 Debug.Print rs.Fields(i)
0012 Stop
0013 Next i
0014 rs.MoveNext
0015Loop
0016End Sub

Tables / Queries / Fragments Directly Used By This Procedure (Checker) Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Count_BookPapers
Procedure Type: Public Function
Module: New Code
Lines of Code: 13

Line-No. / Ref.Code Line
0001Public Function Count_BookPapers(strDataQuery_Saved, Author, Medium)
0002Dim rs As Recordset
0003Dim strQuery As String
0004strQuery = "SELECT Count(" & strDataQuery_Saved & ".Title) AS CountOfTitle FROM " & strDataQuery_Saved & " GROUP BY " & strDataQuery_Saved & ".Author_Name, " & strDataQuery_Saved & ".Medium HAVING (((" & strDataQuery_Saved & ".Author_Name)=""" & Author & """) AND ((" & strDataQuery_Saved & ".Medium)=""" & Medium & """));"
0005Set rs = CurrentDb.OpenRecordset(strQuery)
0006If rs.EOF Then
0007 Count_BookPapers = 0
0008Else
0009 rs.MoveLast
0010 Count_BookPapers = rs.Fields(0)
0011End If
0012Set rs = Nothing
0013End Function

Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Form_Open
Procedure Type: Private Sub
Module: Form_MainForm
Lines of Code: 12

Line-No. / Ref.Code Line
0001Private Sub Form_Open(Cancel As Integer)
0002Dim rsTableToRead As Recordset
0003 Check_Database_Size
0004 Set rsTableToRead = CurrentDb.OpenRecordset("SELECT Archive_Reading_Lists, Archive_Printable_Versions, Document_Tables_Full, Document_Queries_Full FROM System_Parameters;")
0005rsTableToRead.MoveFirst
0006Archive_Reading_Lists = rsTableToRead.Fields(0).Value
0007Archive_Printable_Versions = rsTableToRead.Fields(1).Value
0008Document_Tables_Full = rsTableToRead.Fields(2).Value
0009Document_Queries_Full = rsTableToRead.Fields(3).Value
0010Full_Regen = False
0011Set rsTableToRead = Nothing
0012End Sub

Procedures Called By This Procedure (Form_Open) Tables / Queries / Fragments Directly Used By This Procedure (Form_Open) Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_19
Procedure Type: Public Function
Module: Functors
Lines of Code: 37
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_19(Note_ID, Note_Title, Note_Text)
0002'Add jump table and record counts for Aeon Note 1292
0003Dim rs As Recordset
0004Dim strQuery As String
0005Dim Papers_Read As Integer
0006Dim Papers_UnRead(10) As Integer
0007Dim Note_Text_Local As String
0008Dim i As Integer
0009Note_Text_Local = Note_Text
0010 strQuery = "SELECT Count(Aeon_Files.WebRef_ID) AS CountOfWebRef_ID FROM Aeon_Files WHERE (((Aeon_Files.Aeon_Note_ID)=1292) AND ((Aeon_Files.[Read?])=True) AND ((Aeon_Files.[Exclude?])=False));"
0011Set rs = CurrentDb.OpenRecordset(strQuery)
0012If Not rs.EOF Then
0013 rs.MoveFirst
0014 Papers_Read = rs.Fields(0)
0015End If
0016 strQuery = "SELECT Aeon_Files.Priority, Count(Aeon_Files.WebRef_ID) AS CountOfWebRef_ID FROM Aeon_Files WHERE (((Aeon_Files.Aeon_Note_ID) = 1292) And ((Aeon_Files.[Read?]) = False) AND ((Aeon_Files.[Exclude?])=False)) GROUP BY Aeon_Files.Priority ORDER BY Aeon_Files.Priority;"
0017Set rs = CurrentDb.OpenRecordset(strQuery)
0018If Not rs.EOF Then
0019 rs.MoveFirst
0020 Do Until rs.EOF
0021 Papers_UnRead(rs.Fields(0)) = rs.Fields(1)
0022 rs.MoveNext
0023 Loop
0024End If
0025Note_Text_Local = "<br><CENTER><TABLE class = ""ReadingList"" WIDTH=1200><TR>"
0026Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <a href=""#Off-Page_Link_Project_Note_1292_Intro""><B>Introduction</a></B></TD>"
0027Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <a href=""#Off-Page_Link_Project_Note_1292_Read""><B>Papers Read</a>: </B>" & Papers_Read & "</TD>"
0028Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <B>Papers Unread</B> &rarr; </TD>"
0029For i = 0 To 10
0030 If Papers_UnRead(i) > 0 Then
0031 Note_Text_Local = Note_Text_Local & "<TD class = ""BridgeLeft""> <a href=""#Off-Page_Link_Project_Note_1292_Pri_" & i & """><B>Pri " & i & "</B></a>: " & Papers_UnRead(i) & "</TD>"
0032 End If
0033Next i
0034Note_Text_Local = Note_Text_Local & "</TR></TABLE></CENTER><a name=""Off-Page_Link_Project_Note_1292_Intro""></a>"
0035Note_Text = Note_Text_Local
0036Functor_19 = "Yes"
0037End Function

Procedures Calling This Procedure (Functor_19) Tables / Queries / Fragments Directly Used By This Procedure (Functor_19) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_21
Procedure Type: Public Function
Module: Functors
Lines of Code: 94
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_21(strParameter, strTable)
0002'This function formats a web-table from a Cross-tab query
0003Dim rs As Recordset
0004Dim i As Integer
0005Dim j As Long
0006Dim k(100)
0007Dim iRows As Integer
0008Dim iCols As Integer
0009Dim strTable_Local As String
0010Dim strElement As String
0011Dim strCell As String
0012Dim strQuery As String
0013Select Case strParameter
0014 Case 1
0015 strQuery = "Cross_Reference_By_Type"
0016 Case 2
0017 strQuery = "Cross_Reference_Changes_By_Type"
0018End Select
0019strTable_Local = ""
0020j = 0
0021For i = 1 To 100
0022 k(i) = 0
0023Next i
0024Set rs = CurrentDb.OpenRecordset(strQuery)
0025If rs.EOF Then
0026 Debug.Print Now(); "Cross_Tab_Table_GEN : No table to print"
0027 Functor_21 = "No"
0028 Exit Function
0029Else
0030 rs.MoveLast
0031 iRows = rs.RecordCount
0032 iCols = rs.Fields.Count
0033 rs.MoveFirst
0034End If
0035'Set up Table Header
0036strElement = "<table width=900 class = ""Bridge"">"
0037strTable_Local = strTable_Local & strElement
0038'Set up Table Headings
0039strElement = "<tr>"
0040For i = 1 To iCols
0041 strCell = rs.Fields(i - 1).Name
0042 strElement = strElement & "<th>" & strCell & "</th>"
0043Next i
0044strElement = strElement & "<th>TOTAL</th></tr>"
0045strTable_Local = strTable_Local & strElement
0046'Set up Table Rows
0047strElement = ""
0048Do Until rs.EOF
0049 strElement = strElement & "<tr>"
0050 j = 0
0051 For i = 1 To iCols
0052 If i = 1 Then
0053 strCell = rs.Fields(0)
0054 strElement = strElement & "<th>" & strCell & "</th>"
0055 Else
0056 strCell = rs.Fields(i - 1) & ""
0057 If strCell = "" Then
0058 strCell = "&nbsp;"
0059 Else
0060 j = j + Val(strCell)
0061 k(i) = k(i) + Val(strCell)
0062 OK = Number_Format(strCell)
0063 End If
0064 strElement = strElement & "<td format="","">" & strCell & "</td>"
0065 End If
0066 Next i
0067 'Row Total
0068 strCell = j
0069 OK = Number_Format(strCell)
0070 strElement = strElement & "<th>" & strCell & "</th></tr>"
0071 k(iCols + 1) = k(iCols + 1) + j
0072 rs.MoveNext
0073Loop
0074strTable_Local = strTable_Local & strElement
0075'Set up Total Line
0076strElement = "<tr><th>TOTAL</th>"
0077For i = 2 To iCols + 1
0078 strCell = k(i)
0079 OK = Number_Format(strCell)
0080 If strCell = 0 Then
0081 strCell = "&nbsp;"
0082 End If
0083 strElement = strElement & "<th>" & strCell & "</th>"
0084Next i
0085strElement = strElement & "<tr>"
0086strTable_Local = strTable_Local & strElement
0087'Set up Table Footer
0088strElement = "</table>"
0089strTable_Local = strTable_Local & strElement
0090'Tidy up and exit
0091Functor_21 = "Yes"
0092strTable = strTable_Local
0093Set rs = Nothing
0094End Function

Procedures Calling This Procedure (Functor_21) Procedures Called By This Procedure (Functor_21) Tables / Queries / Fragments Directly Used By This Procedure (Functor_21) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_22
Procedure Type: Public Function
Module: Functors
Lines of Code: 51
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_22(strParameter, strList)
0002'This function formats a list (together with surrounding narrative) from a query
0003Dim rs As Recordset
0004Dim strList_Local As String
0005Dim strElement As String
0006Dim strCell As String
0007Dim strQuery As String
0008Select Case strParameter
0009 Case 1
0010 strQuery = "Cross_Reference_By_Year"
0011 strElement = "However, there are (as of " & Now() & ", using +CFunctor_22C+ & query +QCross_Reference_By_YearQ+) the following counts of records on the table with timestamps in the years below:- "
0012 Case 2
0013 strQuery = "Cross_Reference_Changes_By_Year"
0014 strElement = ""
0015 Case 3
0016 DoCmd.OpenQuery ("Functor_Descriptions_GEN")
0017 strQuery = "Functor_Descriptions_List"
0018 strElement = ""
0019 Case 4
0020 strQuery = "Cross_Reference_Changes_By_Month"
0021 strElement = ""
0022End Select
0023Set rs = CurrentDb.OpenRecordset(strQuery)
0024strList_Local = ""
0025If rs.EOF Then
0026 Debug.Print Now(); "Functor_22: Option " & strParameter & " - No list to print"
0027 Functor_22 = "No"
0028 Exit Function
0029Else
0030 rs.MoveFirst
0031End If
0032'Set up List Header
0033strElement = strElement & "|##|"
0034strList_Local = strList_Local & strElement
0035strElement = ""
0036Do Until rs.EOF
0037 strElement = strElement & "|.|"
0038 strElement = strElement & "<b>" & rs.Fields(0) & "</b>: "
0039 strCell = rs.Fields(1)
0040 OK = Number_Format(strCell)
0041 strElement = strElement & strCell
0042 rs.MoveNext
0043Loop
0044strList_Local = strList_Local & strElement
0045'Set up End List
0046strElement = "|##|"
0047strList_Local = strList_Local & strElement
0048Functor_22 = "Yes"
0049strList = strList_Local
0050Set rs = Nothing
0051End Function

Procedures Calling This Procedure (Functor_22) Procedures Called By This Procedure (Functor_22) Tables / Queries / Fragments Directly Used By This Procedure (Functor_22) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Functor_23
Procedure Type: Public Function
Module: Functors
Lines of Code: 59
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Functor_23(strOption, strValue)
0002'This function returns a value (together with surrounding narrative) from a query
0003'Currently only two formats ... could be others in due course
0004Dim rs As Recordset
0005Dim strValue_Local As String
0006Dim strElement As String
0007Dim strMsg As String
0008Dim strQuery As String
0009Select Case strOption
0010 Case "1"
0011 strQuery = "Dud_Cross_References_This_Year"
0012 Set rs = CurrentDb.OpenRecordset(strQuery)
0013 Case "2"
0014 strQuery = "Cross_Reference_MaxID"
0015 Set rs = CurrentDb.OpenRecordset(strQuery)
0016 Case "3"
0017 strQuery = "SELECT Count(Cross_Reference_Changes.ID) AS CountOfID FROM Cross_Reference_Changes;"
0018 Set rs = CurrentDb.OpenRecordset(strQuery)
0019 Case Else
0020 Debug.Print Now(); "Insert_Value : Invalid Option : " & strOption
0021 Functor_23 = "No"
0022 Exit Function
0023End Select
0024strValue_Local = ""
0025If rs.EOF Then
0026 Debug.Print Now(); "Insert_Value : No item to print (Option = " & strOption & ")"
0027 Functor_23 = "No"
0028 Exit Function
0029End If
0030Select Case strOption
0031 Case "1"
0032 rs.MoveLast
0033 strElement = rs.Fields(1)
0034 If rs.Fields(0) <> rs.Fields(2) Then
0035 strElement = 0
0036 End If
0037 If strElement = 0 Then
0038 strElement = "no"
0039 strMsg = "encouraging."
0040 Else
0041 strMsg = "worrying. Investigate!"
0042 Debug.Print Now(); "Insert_Value : Non-zero value printed - Investigate!"
0043 End If
0044 strValue_Local = strElement & " records for " & rs.Fields(2) & " prior to the " & rs.Fields(3) & " regeneration, which is " & strMsg
0045 Case "2"
0046 rs.MoveFirst
0047 strElement = rs.Fields(0)
0048 OK = Number_Format(strElement)
0049 strValue_Local = Now() & " it is " & strElement & " - but it's taken " & Year(Now) - 2015
0050 Case "3"
0051 rs.MoveFirst
0052 strElement = rs.Fields(0)
0053 OK = Number_Format(strElement)
0054 strValue_Local = strElement & " rows, as of " & Now() & ", "
0055End Select
0056Functor_23 = "Yes"
0057strValue = strValue_Local
0058Set rs = Nothing
0059End Function

Procedures Calling This Procedure (Functor_23) Procedures Called By This Procedure (Functor_23) Tables / Queries / Fragments Directly Used By This Procedure (Functor_23) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Jacks_Non_Prime
Procedure Type: Public Sub
Module: Testing
Lines of Code: 36
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Sub Jacks_Non_Prime()
0002'Prove that 2^10 + 5^12 is non-prime
0003'The program shows:-
0004'... The number is 244,141,649 = 14657 x 16657
0005'... Max Long is 2,147,483,647, so didn't need LongLong
0006Dim Non_Prime As LongLong
0007Dim Non_Prime_Temp As LongLong
0008Dim Non_Prime_Sqrt As Integer
0009Dim i As Integer
0010Non_Prime_Temp = 1
0011For i = 1 To 10
0012 Non_Prime_Temp = Non_Prime_Temp * 2
0013Next i
0014Debug.Print Non_Prime_Temp
0015Non_Prime = Non_Prime_Temp
0016Non_Prime_Temp = 1
0017For i = 1 To 12
0018 Non_Prime_Temp = Non_Prime_Temp * 5
0019Next i
0020Debug.Print Non_Prime_Temp
0021Non_Prime = Non_Prime + Non_Prime_Temp
0022Debug.Print Non_Prime
0023Non_Prime_Sqrt = Non_Prime ^ 0.5
0024Debug.Print Non_Prime_Sqrt
0025Non_Prime_Sqrt = Non_Prime_Sqrt / 2 + 1
0026For i = 1 To Non_Prime_Sqrt
0027 Non_Prime_Temp = Non_Prime Mod (2 * i + 1)
0028 If Non_Prime_Temp = 0 Then
0029 Debug.Print 2 * i + 1
0030 Non_Prime_Temp = Non_Prime / (2 * i + 1)
0031 Debug.Print Non_Prime_Temp
0032 Non_Prime_Temp = Non_Prime_Temp * (2 * i + 1)
0033 Debug.Print Non_Prime_Temp
0034 End If
0035Next i
0036End Sub

Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



Source Code of: Number_Format
Procedure Type: Public Function
Module: New Code
Lines of Code: 39
Go To End of This Procedure

Line-No. / Ref.Code Line
0001Public Function Number_Format(strNumber_Sent)
0002Dim strNumber_Local As String
0003Dim Digit_Table(20) As String
0004Dim i As Integer
0005Dim j As Integer
0006Dim iLen_Number As Integer
0007'This function inserts commas into a number sent ...
0008'I may get it to do further functions in due course
0009' .... I couldn't find an HTML format command to do this
0010' .... but there must be a VBA built-in function?
0011strNumber_Local = Trim(strNumber_Sent)
0012If Not IsNumeric(strNumber_Local) Then
0013 Exit Function
0014End If
0015iLen_Number = Len(strNumber_Local)
0016For i = 1 To 20
0017 Digit_Table(i) = ""
0018Next i
0019'Add the commas (in reverse)
0020j = 1
0021For i = 1 To iLen_Number
0022 Digit_Table(j) = Mid(strNumber_Local, iLen_Number + 1 - i, 1)
0023 j = j + 1
0024 If i Mod 3 = 0 Then
0025 Digit_Table(j) = ","
0026 j = j + 1
0027 End If
0028Next i
0029'Remove trailing comma
0030If Digit_Table(j - 1) = "," Then
0031 Digit_Table(j - 1) = ""
0032End If
0033strNumber_Local = ""
0034For i = 1 To j - 1
0035 strNumber_Local = strNumber_Local & Digit_Table(j - i)
0036Next i
0037'Exit
0038strNumber_Sent = strNumber_Local
0039End Function

Procedures Calling This Procedure (Number_Format) Go To Start of This Procedure
Go To Top of This Page
Link to VBA Code Control Page



© Theo Todman, June 2007 - June 2020. Please address any comments on this page to theo@theotodman.com. File output:
Website Maintenance Dashboard
Return to Top of this Page Return to Theo Todman's Philosophy Page Return to Theo Todman's Home Page