This paper shows how spreadsheet software such as Microsoft Excel can be used as a pattern to create Java program code that forms part of a Java class. Such a programming technique can be used in an introductory programming course to emphasize to the student the concept of a program as text. Although useful in its own right, this metaprogramming technique of creating program code is useful in demonstrating that program code need not be written manually. A complete simple example is provided and important details of a nontrivial example are discussed. Java is used as the target code, but the method can be used with any programming language and is simple enough to be used by programmers at any level. Extensions to some nontrivial statistical problems/functions are briefly discussed.