Word Hacks [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Word Hacks [Electronic resources] - نسخه متنی

Andrew Savikas

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







Hack 37 Delete All Bookmarks in a Document

Word offers no built-in way to delete all of a
document's bookmarks at once. This hack shows you
how to do it with some VBA.

Bookmarks let you quickly
navigate through a document. But if you
will eventually import your document into another program, such as
Quark or FrameMaker, those bookmarks can cause troublefor
example, FrameMaker attempts to convert some bookmarks into its own
similar "marker" feature, but it
often creates unresolved cross-references that you must delete.
Conversely, when exporting to Word format from another program, the
program may create bookmarks of questionable value in the Word
document.

You can select InsertBookmark and delete bookmarks one at a
time, but if a document has dozens or more, you'll
be clicking for a while. The macro in this hack will delete them all
at once.


4.12.1 The Code


Place this macro in the template of your choice [Hack #50]
and either run it from the ToolsMacroMacros
dialog or put a button for it on a menu or toolbar [Hack #1].

The following macro deletes every bookmark in a document:

Sub DeleteAllBookmarks( )
Dim i As Integer
For i = ActiveDocument.Bookmarks.Count To 1 Step -1
ActiveDocument.Bookmarks(i).Delete
Next i
End Sub


4.12.2 Hacking the Hack


Word hides some of the bookmarks it creates, such as the ones for
cross-references, by default. A hidden bookmark
isn't included when iterating through each bookmark
in a document, unless the "Hidden
bookmarks" box in the InsertBookmark
dialog is checked. To be sure you get all of them, this version of
the macro turns on that setting before running:

Sub DeleteAllBookmarksIncludingHidden( )
Dim i As Integer
Activedocument.Bookmarks.ShowHidden = True
For i = ActiveDocument.Bookmarks.Count To 1 Step -1
ActiveDocument.Bookmarks(i).Delete
Next i
End Sub


/ 162