I have a reason for printing/typing a numeric value enclosed in square brackets, thus from the value 1 I should receive the four-character string
Code: Select all
[01]
Code: Select all
Sub test()
Debug.Print Format(1, "00") ' basic two-digit format
Debug.Print Format(1, "-00") ' basic two-digit format
Debug.Print Format(1, "[00") ' appears to return a null/blank string
Debug.Print Format(1, "[00]") ' does NOT format as I want (enclosed in square brackets)
Debug.Print Format(1, "(00)") ' shows I can use PARENTHESES
Debug.Print Format(1, "{00}") ' shows I can use BRACES
Debug.Print "[" & Format(1, "00") & "]" ' clumsy but effective
End Sub
But I am puzzled because I searched the web to see what meaning the (2003) VBA function FORMAT attaches to the square brackets and could not find an answer.
https://docs.microsoft.com/en-us/office ... plications
https://www.techonthenet.com/excel/form ... string.php
https://www.excelfunctions.net/vba-format-function.html
http://exceldevelopmentplatform.blogspo ... ck-to.html
https://www.mrexcel.com/board/threads/a ... er.114052/
And yes, in desperation I turned to Excel/VBA, even though I am using Word/VBA.
In all my Formatting (starting a long, long time ago with FORTRAN II) I can't recall ever using square brackets as reserved symbols within a format statment.
Within regular Expressions, yes, and in proprietary languages, yes; but never with formatting.
So I am curious - what is it about SQUARE brackets that causes Word2003/VBA to hiccough?
(signed) Just Curious" of Bonavista
Code: Select all
01
-01
1
(01)
{01}
[01]