Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jobrad on github.
  • I am jobrad (https://keybase.io/jobrad) on keybase.
  • I have a public key ASCZLctCsNJRq2FWO6H4H8btMYNQgGLkKfoUdaxsGyy7Hwo

To claim this, I am signing this object:

@JoBrad
JoBrad / VBAWriteUTF8.vb
Last active December 14, 2023 10:30
[VBA] Write a UTF-8 Encoded File
'Function saves cText in file, and returns 1 if successful, 0 if not
Public Function writeOut(cText As String, file As String) As Integer
On Error GoTo errHandler
Dim fsT As Object
Dim tFilePath As String
tFilePath = file + ".txt"
'Create Stream object
Set fsT = CreateObject("ADODB.Stream")
@JoBrad
JoBrad / VBAWrapText.vb
Created June 13, 2011 19:20
[VBA] Wrap text at 69 characters, with no orphans
Private Function wrapText(text As String, Optional wrapLength As Integer) As String
Dim x As Integer, newString() As String, preSplit() As String, mySplit() As String, maxWords As Long, y As Integer, finalString As String, isEnd As Boolean
'Default wraplength to 69
If wrapLength = 0 Then wrapLength = 69
x = 0
y = 0
z = 0
'Check to see if ay wrapping should be done
If Len(text) > wrapLength Then