Today I surfed some random geek-stuff articles on wikipedia to get my daily dose of useless knowledge. I stumbled accross quines, which are programs that print their own source-code. I found that a great way to make my brain hurt, so I began working on a quine in VBA. I had two good reasons:
Here is my masterpiece:
Sub q()
c = "Sub q();c = #;Debug.Print Replace(Replace(c, Chr(59), vbNewLine), Chr(35), Chr(34) & c & Chr(34));End Sub"
Debug.Print Replace(Replace(c, Chr(59), vbNewLine), Chr(35), Chr(34) & c & Chr(34))
End Sub
My challenge: Can you make it even shorter (and preferably more awkward)?
How about
Sub q() '//in mdl1
Debug.Print Workbooks(1).VBProject.VBComponents(5).CodeModule.Lines(1, 3)
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With