Showing posts with label Code the Law. Show all posts
Showing posts with label Code the Law. Show all posts

Thursday, September 4, 2014

Free Course for Learning Python

I'm a big fan of Coursera and its free, online courses. I did the Android programming course a while back and learned a lot. Starting September 15, Coursera will be offering a free course on learning the Python computer language. It is designed for those without computer programming experience. So, even if you have no programming background, you shouldn't feel completely adrift. And if you don't like it, you're not out any money.

Monday, March 3, 2014

USE A MACRO TO ADD YOUR LETTERHEAD TO A DOCUMENT

Previously, we explained how to create an officewide letterhead template so that everyone in your office would always use the same letterhead and updating it could be done one time and everyone would get the update. Today, let's take that idea one step farther and create a macro that will put the letterhead on your open document.

The comments in the macro explain exactly how and why the macro works. For those not interested in why the macro works, running the macro on an open document will create a new file with the text of your open document but the header and footer of your letterhead template.

The blue, courier text below is the entirety of the macro. The only customization required is inserting the path and file name of your letterhead template in the red text below. For example, if your letterhead template was called letterhead.dotm and was stored in a folder on your c:\ drive called templates, then you would replace the red text with c:\templates\letterhead.dotm.

Sub LetterHead()
'
' Letterhead Macro
' add letterhead to existing document
' Joshua Goodwin 2012
'

'copy current document
Selection.WholeStory
Selection.Copy

'close current document without saving
ActiveDocument.Close (wdDoNotSaveChanges)


' define path and filename for letter head template

Dim LetterHead As String

LetterHead = "replace red text with path and filename for your letterhead template"

' open letterhead template
Documents.Add Template:= _
        LetterHead, _
        NewTemplate:=False, DocumentType:=0

'paste into letterhead
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.PasteAndFormat (wdFormatOriginalFormatting)

End Sub

Thursday, February 20, 2014

A MACRO TO PRINT ENVELOPES WITH POSTNET BARCODES

A while back, a colleague of mine asked how they could print envelopes with the POSTNET barcode on them. It turns out that Microsoft Word doesn't make this a simple process. So, I decided to write a macro to do this for them. I thought I would share it.

I've pasted the macro VBA code in blue below for you to copy into your own macro module. To use the macro, highlight the recipient's address in your document and run the macro. It will then ask you to type in the zip code. It will then print both your letter and an envelope with the POSTNET barcode on it.

As a note, please remember that I am an attorney and am entirely self-trained when it comes to programming. So if you see the code and cringe, I'd welcome any feedback on how it could be improved.

Sub BarCode()

'
' Joshua Goodwin
' 4/16/2012
' Adds an envelope and POSTNET barcode to document


'  Define and fill Variables

    Dim strAddress
    Dim strZipCode As String

    strAddress = Selection.Text
                  
    strZipCode = InputBox("What is the Zip Code?")

' print letter

 Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
        wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
        PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0
    
 ' Create envelope and add to document
    
    ActiveDocument.Envelope.Insert Address:=strAddress & "**"
        
 ' Find location to insert barcode
    Selection.MoveUntil cset:="**"
    
    Selection.MoveRight Unit:=wdCharacter, Count:=2
    Selection.TypeBackspace
    Selection.TypeBackspace
    
 ' insert barcode

    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
        "BARCODE  \u" & strZipCode, PreserveFormatting:=True
    
 ' Print envelope
    
    ActiveDocument.Envelope.PrintOut
  
 ' Delete envelope from document
  
    ActiveDocument.Undo (4)
    


End Sub

Tuesday, January 28, 2014

TAKE A PROGRAMMING CLASS

Light blogging over the next few days while my wife and I welcome our newest child into our home. He was born yesterday morning and everyone is doing well.

In the meantime, I would encourage everyone to learn at least a little about computer programming. I'm taking a few classes now, and while I have some background, I'm learning a lot. I think one of the things that law school does is to teach you to think differently than what you might have been taught elsewhere. For me, learning to code requires a very systematic way of thinking. One where you need to take large ideas and break them down to their smallest components. This way of thinking has obvious parallels to the practice of law.

So even if you don't want to write computer programs or design websites, I'd encourage everyone to take a course. For example, I'm taking a course on Java as well as a course on the Android operating system.

Wednesday, December 11, 2013

CODING THE LAW

I grew up with a father in the IT business. I remember learning to code in BASIC on a Commodore 64 and an Apple II in elementary school. While I have never taken any formal computer science classes, I have taught myself enough about coding to work on a few side projects related to the practice of law.

One of my recent projects was to actually create a website that calculates the amount of food stamps a person is entitled to. The easiest part of this project was reading the Ohio Revised Code and Administrative Code and learning the rules for counting income, deductions, and the various tests. It was breaking those rules down into manageable chunks that could be understood by a web browser, which is not so different from explaining it to a lay person.

In doing this project, I learned all of the ins and outs of the food stamp program, and I now have a much better grasp of the rules surrounding it. In addition, our program now has a useful tool in the form of a website that will help us determine whether our clients' food stamps are being properly determined.

I would encourage everyone to look for areas of the law that lend themselves to being coded and to give it a try, particularly if it is your area of specialty. Doing so will give you a deeper appreciation for the law's nuances and help you see the law at both the micro and macro level.