Writing Word Macros
暫譯: 撰寫 Word 巨集

PhD Steven Roman

  • 出版商: O'Reilly
  • 出版日期: 1999-11-23
  • 售價: $1,900
  • 貴賓價: 9.5$1,805
  • 語言: 英文
  • 頁數: 412
  • 裝訂: Paperback
  • ISBN: 1565927257
  • ISBN-13: 9781565927254
  • 相關分類: Word
  • 已過版

買這商品的人也買了...

商品描述

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

Not intended to be an encyclopedia of Word programming, Writing Word Macros provides Word users, as well as programmers who are not familiar with the Word object model with a solid introduction to writing VBA macros and programs. In particular, the book focuses on:
  • 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.


Writing Word Macros is written in a terse, no-nonsense manner that is characteristic of Steven Roman's straightforward, practical approach. Instead of a slow-paced tutorial with a lot of hand-holding, Roman offers the essential information about Word VBA that you must master to program effectively. This tutorial is reinforced by interesting and useful examples that solve practical programming problems, like generating tables of a particular format, managing shortcut keys, creating fax cover sheets, and reformatting documents.
Writing Word Macros is the book you need to dive into the basics of Word VBA programming, enabling you to increase your power and productivity when using Microsoft Word

Table of Contents

Preface

1. Introduction

2. Preliminaries

I. The VBA Environment

3. The Visual Basic Editor, Part I

4. The Visual Basic Editor, Part II

II. The VBA Programming Language

5. Variables, Data Types, and Constants

6. Functions and Subroutines

7. Built-in Functions and Statements

8. Control Statements

III. Objects and Object Models

9. Object Models

10. The Word Object Model

11. The Application Object

12. The Document Object

13. The Section and HeaderFooter Objects

14. The Range and Selection Objects

15. The Find and Replace Objects

16. The Table Object

17. The List Object

18. Shortcut Key Bindings

19. Built-in Dialog Objects

20. Custom Dialog Boxes

21. Menus and Toolbars

IV. Appendixes

A. Programming Word from Another Application

B. The Shape Object

C. Getting the Installed Printers

D. High-Level and Low-Level Languages

商品描述(中文翻譯)

許多 Microsoft Word 使用者和 VBA 程式設計師並未意識到,當使用 Visual Basic for Applications (VBA) 存取 Word 的物件模型時,存在著廣泛的機會。VBA 取代了 WordBasic,並隨著 Word 97 的發布而推出。透過創建通常稱為「Word 宏」的功能,您可以自動化 Word 中許多可用的功能。《撰寫 Word 宏》(前稱《學習 Word 程式設計》)是一本介紹 Word VBA 的書籍,讓您能夠執行這些操作及更多,包括:
- 創建自定義彈出式選單
- 自動從列表中創建表格
- 將一個文檔附加到另一個文檔的結尾(或開頭)
- 創建一個切換開關,通過在頁首添加或移除水印來將文檔從草稿轉換為最終版本
- 使用來自其他應用程序的數據生成報告

《撰寫 Word 宏》並不打算成為 Word 程式設計的百科全書,而是為 Word 使用者以及不熟悉 Word 物件模型的程式設計師提供了一個堅實的 VBA 宏和程式編寫入門。特別是,這本書專注於:
- Visual Basic 編輯器和 Word VBA 程式設計環境。Word 提供了一個完整且非常強大的集成開發環境,用於編寫、運行、測試和調試 VBA 宏。
- VBA 程式設計語言(這是 Microsoft Excel、Access 和 PowerPoint 以及 Visual Basic 零售版本所使用的相同程式設計語言)。
- Word 物件模型。Word 通過其物件模型公開幾乎所有功能,這使得可以使用 VBA 以程式化方式控制 Word。雖然 Word 物件模型擁有近 200 個物件,是 Office 應用程序中最大的,但讀者只需熟悉少數幾個物件。《撰寫 Word 宏》專注於這些基本物件,但也包括了許多其他物件的討論。

《撰寫 Word 宏》以簡潔、直截了當的方式撰寫,這是 Steven Roman 直接、實用的方法的特徵。與其說是慢節奏的教程,還不如說 Roman 提供了您必須掌握的 Word VBA 的基本資訊,以便有效地進行程式設計。這個教程通過有趣且實用的範例來加強,這些範例解決了實際的程式設計問題,例如生成特定格式的表格、管理快捷鍵、創建傳真封面和重新格式化文檔。《撰寫 Word 宏》是您深入了解 Word VBA 程式設計基礎的書籍,使您在使用 Microsoft Word 時能夠提高您的能力和生產力。

目錄
前言
1. 介紹
2. 預備知識

I. VBA 環境
3. Visual Basic 編輯器,第一部分
4. Visual Basic 編輯器,第二部分

II. VBA 程式設計語言
5. 變數、數據類型和常數
6. 函數和子程序
7. 內建函數和語句
8. 控制語句

III. 物件和物件模型
9. 物件模型
10. Word 物件模型
11. 應用程序物件
12. 文檔物件
13. 節和頁眉頁腳物件
14. 範圍和選擇物件
15. 查找和替換物件
16. 表格物件
17. 列表物件
18. 快捷鍵綁定
19. 內建對話框物件
20. 自定義對話框
21. 菜單和工具列

IV. 附錄
A. 從其他應用程序編程 Word
B. 形狀物件
C. 獲取已安裝的打印機
D. 高級語言和低級語言