Writing Word Macros (英語) ペーパーバック – 1999/10/1
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
Many Microsoft Word users and VBA programmers don't realize the extensive opportunities that exist when Word's Object Model is accessed using Visual Basic for Applications (VBA), which replaced WordBasic in conjunction with the release of Word 97. By creating what is commonly called a "Word Macro" you can automate many features available in Word. Writing Word Macros (previously titled Learning Word Programming is the introduction to Word VBA that allows you to do these things and more, including:
- Create custom pop-up menus
- Automatically create tables from lists
- Append one document to the end (or beginning) of another
- Create a toggle switch to change a document from draft to final copy by adding or removing a watermark in the header
- Generate reports using data from other applications
- The Visual Basic Editor and the Word VBA programming environment. Word features a complete and very powerful integrated development environment for writing, running, testing, and debugging VBA macros.
- The VBA programming language (which is the same programming language used by Microsoft Excel, Access, and PowerPoint, as well as the retail editions of Visual Basic).
- The Word object model. Word exposes nearly all of its functionality through its object model, which allows Word to be controlled programmatically using VBA. While the Word object model, with almost 200 objects, is the largest among the Office applications, readers need be familiar with only a handful of objects. Writing Word Macros focuses on these essential objects, but includes a discussion of a great many more objects as well.
Steven Roman is Professor Emeritus of mathematics at the California State University, Fullerton. He has taught at a number of other universities, including MIT, the University of California at Santa Barbara, and the University of South Florida. Dr. Roman received his B.A. degree from the University of California at Los Angeles and his Ph.D. from the University of Washington. Dr. Roman has authored 32 books, including a number of books on mathematics, such as Coding and Information Theory, Advanced Linear Algebra, and Field Theory,published by Springer-Verlag. He has also written a series of 15 small books entitled Modules in Mathematics, designed for the general college-level liberal arts student. Besides his books for O'Reilly (Access Database Design & Programming, Learning Word Programming, Writing Excel Macros, Developing Visual Basic Add-Ins, Win32 API Programming with Visual Basic (in production)), Dr. Roman has written two other computer books, entitled Concepts of Object-Oriented Programming with Visual Basic and Understanding Personal Computer Hardware, an in-depth look at how PC hardware works, both published by Springer-Verlag. Dr. Roman is interested in combinatorics, algebra, and computer science.
Another item that becomes readily apparent is that Roman felt the need to bulk up the book by restating meaningless statistics at every opportunity. I easily read 5-6 times that there are 188 Word objects compared to Access' 51 (like it matters) or Excel's 184 (so what?). After stating it in paragraphs numerous times, he even shows a graph comparing the different applications objects. He also spends a good amount of time plugging other books he has written or software he has for sale. The book does contain enough detail to learn the basics of Word Macros, but if you're already a programmer, you probably wont get enough detail to satisfy you. If you are new to programming, you may get frustrated by the scant detail on the VBA language itself.
Several people have complained about those first chapters where Mr. Roman is not talking about how to actually program Word using VBA, but rather introducing the tools that will make your job easier when he does begin discussing the VBA programming language (for example: what windows are available when you enter the Word VBA environment, and what useful information do they contain?). For these chapters alone, I would have bought the book; and for these chapters, I will keep the book nearby no matter what Microsoft application I'm writing VBA code for.
Another complaint offered by some is the many lists Mr. Roman offers of built-in function statements (134 of them - pp 85 and 86); VBA statements (92 of them - p.86); msgbox button argument values (16 of them - p.87); collection objects (25 of them - pp 112-113); global objects...; Word-specific objects...; enums...; properties...; and methods...
I am delighted that he has taken the trouble to put these lists into a single reference book. I wish they had all been gathered together into one or several contiguous Appendices, but here's why I'm glad that, at least, they're included.
I often want to do something, but don't know the right keywords to construct the code. If I scan down the appropriate list it often jogs my memory of forgotten statements, objects, methods, etc., or provides new ones (to me) whose names indicate they may be useful.
But there is much more to this book than simple lists; the structure of the VBA language is explained; the text is peppered with helpful suggestions and details about how to implement them (use keyboard shortcuts; use modular programming, comment liberally in your code, etc.). The major techniques for achieving results with VBA programming ARE covered - this book is NOT just a compendium of lists.
Personally speaking, I didn't find any particular need to compare VBA with FORTRAN, COBOL, C++, etc. I especially don't care to see even the simple coding examples he provides in each of those languages to illustrate the differences (at least such comparisons are isolated to one or two parts of the book). Maybe someone would find this useful, I found it mildly annoying. However, not annoying enough to reduce my overall rating of the book by even a fraction of a star.
Recognizing the innate limitations, I give it a strong recommendation.