Thursday, July 5, 2007

FW: WordTips for 29 June 2002

-----Original Message-----
From: WordTips [mailto:awyatt@dcomp.com]
Sent: Saturday, June 29, 2002 10:20 AM
To: sathyamurthy@netkracker.com
Subject: WordTips for 29 June 2002

WordTips for 29 June 2002 Copyright 2002 by DCI
**********************************************************************

In This Issue...
----------------
Publisher's Notes
Tips
* Sorting Single-Column Addresses
* Suppressing a Zero In a Calculated Sum
* Making Macros Run Faster, Take Two
* Hiding and Displaying Hidden Text
Help Wanted
* Changing the Height of a Font
* Marking Multiple Documents
Publisher and Copyright Information
Important Links
Subscription Information


[BOLD>[72 pt> REVEAL the CODES in WORD <72 pt]<BOLD]¶
[BOLD>[ITALIC> If you're new to Word... <ITALIC]<BOLD]¶
[Emphasis> or you're a seasoned expert... <Emphasis]¶
[TrueStyle> You must try CrossEyes® Today! ¶
[BkMk OurSite>

http://www.levitjames.com

<BkMk OurSite]¶
[BOLD>[72 pt> *** Version 2.0 Now Shipping *** <72 pt]<BOLD]¶


**********************************************************************
PUBLISHER'S NOTES * PUBLISHER'S NOTES * PUBLISHER'S NOTES
**********************************************************************


Over the last couple of months many people have asked about the next volume
of WordTips archives. (If you didn't know that there even are WordTips
archives, check out http://store.vitalnews.com/wtarch.html.)

I want to give those of you awaiting the next volume a heads-up. I am hard
at work on the volume, and I should get it done this next week.
Keep your eyes on this spot; if all goes well, I should announce the
availability of Volume 6 next week.

-Allen


**********************************************************************
TIPS * TIPS * TIPS * TIPS * TIPS * TIPS * TIPS * TIPS * TIPS
**********************************************************************
If you have an idea for a tip, send it our way. You can e-mail the
suggestion to awyatt@dcomp.com. Any tips contributed will be credited in the
issue in which they appear.


------------------------------
Sorting Single-Column Addresses
------------------------------
Subscriber Alexander Krupchest asked if there was an easy way to sort
single-column addresses in Word, such as the following:

Jane R. Doe
1234 Anytown Road
Mapleton, AZ 85229

Fred Davis
5678 Main Street
Yorba Linda, CA 94123

The answer depends on your definition of "easy." The most versatile
long-term solution is to transfer the addresses to some sort of a database
program, or even to Excel. You can organize and sort to your heart's content
in those programs, and then simply merge the results back into Word.

If you are intent on keeping the addresses in Word, then you can sort them
easily, provided a few conditions are met. First of all, each address
"block" (for lack of a better term) must be a single paragraph. This means
that there must be a manual line break
(Shift+Enter) at the end of each line in the address block, except the last
one. Second, the only place in the first line where there can be any regular
spaces is just before the beginning of the last name. For all other spaces
(say, between the first name and middle initial or between a title and the
first name) you should use a non-breaking space.

With the data in the proper condition, you can now sort the addresses by
following these steps:

1. Select all the addresses that you want to sort.
2. Choose Sort from the Table menu. Word displays the Sort Text
dialog box.
3. Click on the Options button. Word displays the Sort Options
dialog box.
4. Make sure Other is selected, and that the small box to the right
of Other contains a single space.
5. Click on OK.
6. Using the Sort By drop-down list, choose the Word 2 option.
(Word considers everything up to the first space on each first
line to be the first word, and then everything thereafter to be
the second word. Since the only space on the first line of each
block is just before the last name, this means you are
instructing Word to sort by last name.)
7. Click on OK.

Your addresses are now sorted properly.

(Thanks to Graham Smith and Suzanne S. Barnhill for contributing to this
tip.)


Help support WordTips and obtain a valuable resource by
purchasing your own copies of the WordTips archives. Visit the
Web site (http://store.vitalnews.com/wtarch.html) for more info,
or send a blank e-mail to WordTips-CDs@lists.vitalnews.com.


------------------------------
Suppressing a Zero In a Calculated Sum
------------------------------
Word allows you to create tables and to do a limited amount of math based on
the cells in the table. Primarily, Word allows you to sum different cells;
for instance, you can sum all the values in a particular column. Exactly how
you do this has been covered in different issues of WordTips.

When calculating a sum, if the values that make up that sum total zero, then
Word will show a zero in the cell where the summation formula is placed. In
some instances you may want Word to simply leave the cell blank if the sum
is zero. There are two ways you can achieve this goal.

First, you can use the picture switch with the SUM field to get exactly the
type of numeric display you want. There are three possible settings you can
use with the picture field, the first for the display of positive numbers,
the second for the display of negative numbers, and the third if the number
is zero. The following use of the SUM field illustrates this concept:

{ =SUM(ABOVE) \# "#,##0.00;(#,##0.00);''" }

This is, of course, a field code, so the outermost brackets are created by
pressing Ctrl+F9. The \# switch indicates that everything following and
enclosed with quote marks constitutes the formats to be used in displaying
the field results. The three settings within the quote marks are separated
by semicolons. Thus, the first setting, #,##0.00, indicates that you want
positive results displays using two decimal places and commas between
thousands. The second setting, (#,##0.00), indicates the same treatment for
negative numbers, except that the result is surrounded by parentheses. The
third setting, which consists of two apostrophes with nothing between them,
indicates that if the result is zero, you want nothing displayed.

The second possible solution is to use a nested field for calculating the
sum. In this case, you would use the IF field to determine if the sum was
zero. If it is, then you display the sum, if not, then you display nothing.
The following is the example:

{ IF { =SUM(ABOVE) } = 0 "" { =SUM(ABOVE) } }

When this nested field is calculated, Word first checks to see if the sum of
the above cells is zero. If it is, then the contents of what is between the
quote marks (nothing) is displayed. If it is not, then the actual sum is
displayed.

(Thanks to Graham Smith, Suzanne S. Barnhill, Phil Rabichow, Aidan Heritage,
Paul Ferrari, David G. Lett, Ventsi Gradinarov, and Arthur R. Hendrickson
for contributing to this tip.)


Got a Word-related product or service you want to let others
know about? Advertising in WordTips is a cost-effective way to let
thousands of serious Word users know about you. For more info,
visit the Web site (http://www.VitalNews.com/WordTips/), or send
a blank e-mail to WordTips-Advertising@lists.vitalnews.com.


------------------------------
Making Macros Run Faster, Take Two
------------------------------
Last week's tip about making macros run faster was met with a good number of
comments, questions, and caveats by WordTips readers. Some readers
recognized the technique described--putting multiple statements on the same
line and separating them with colons--as something that was often done in
older versions of the BASIC programming language. Several readers also asked
for additional information regarding the technique and how it is implemented
"behind the scenes" in VBA. (Even though this macro specifically refers to
VBA, the concepts it discusses and the techniques resulting therefrom are
also applicable to WordBasic macros.)

When you create a macro in VBA, it is "pseudocompiled" or "tokenized"
when you save the macro or when you save the template in which the macro is
stored. Instead of the human-readable form that is visible in the VBA
Editor, each keyword or directive is converted internally to a three-byte
"token" which is easily processed by VBA. Variable names, comments, and
literal string values--none of which are keywords or directives--are not
modified and are saved "as is." Even though VBA tokenizes the keywords and
directives, it does not "compress" any of the lines in the macro; each line
is maintained as it is, with the carriage return at the end of the line
intact.

When the macro is executed, the VBA processor fetches a single line of the
macro at a time. The tokens on the line are interpreted and executed, in the
order that they appear on the line. When one line is completed, the next
line is fetched and executed, and so on, through the end of the macro. When
you combine multiple statements on a single line and separate them by
colons, the idea is to reduce the number of fetch cycles that the processor
must go through. This is where the speedup comes into play; less fetching
means less time spent doing "overhead" and more time spent actually
executing the macro itself.

It should be obvious that when you combine statements on a single line, the
resulting macro can be much more difficult for you, as a human, to read.
Thus, the "optimize" or "don't optimize" decision involves a
tradeoff--harder to read code vs. faster code. It has been this same way
since the early days of BASIC, long before Word was even dreamed of.

You should understand that the time saved by combining statements on a
single line is miniscule, particularly with today's fast computers.
Thus, it doesn't make much sense to combine statements in which the portion
of code will be run only once. The real savings comes into play if the code
will be repeated hundreds or thousands of times during the course of the
macro. The time savings realized from each iteration of the code may be
small, but the cumulative time savings may be quite attractive.

If you decide to "compress" your code by combining multiple statements and
keywords on a single line, there are a few things to keep in mind.
First of all, the maximum line length is 255 characters. Also, Sub
statements, which are used to start macros, must appear on their own line,
as must With and End With statements. (In WordBasic you can concatenate the
Sub statement with other statements, but if you later convert the macro to
VBA, you must manually break the line in two.)

Astute readers probably picked up another idea by the information presented
earlier in this tip. Since the "pseudocompiler" does not compress variable
names, literals, or comments, you can somewhat speed up your macro by
reducing the length of variable names, the use of literals, and the use of
comments. Again, the tradeoff of such a decision is in readability. When
maintaining your macro at a later date, shorter variable names are more
cryptic, and a lack of comments can be counterproductive. Thus, you must be
the judge on whether the tradeoff is worth it.

There is one other interesting thing to note--if you do any concatenation of
lines in your macros, you will obviously want to do some testing to make
sure that they still work as you intend. As you are stepping through the
macros (in the VBA Editor), notice that the Step Into command (F8) still
only executes one statement at a time, not a whole line at a time. This
behavior is specifically for the interactive development environment, and
does not reflect how the VBA engine behaves when the macro is running
full-speed. At run-time, the macro is executed as described above--a full
line at a time.

(Thanks to Hafizullah Chishti for contributing to this tip.)


------------------------------
Hiding and Displaying Hidden Text
------------------------------
Hidden text is text that has the hidden attribute applied. In Word, hidden
is a text attribute just like italics or bold. You can control whether
hidden text is displayed or printed. When the display of hidden text is
turned off, the text is not deleted, its display is simply suppressed--it is
not shown. When you later display hidden text, it will all be displayed
again.

To turn off the display of hidden text on the screen, follow these
steps:

1. Choose Options from the Tools menu. Word displays the Options
dialog box.
2. Make sure View tab is selected.
3. Click the Hidden Text check box. Make sure it is empty.
4. Click on OK.

To later display hidden text, follow the same steps, but make sure the
Hidden Text check box (step 3) is selected.

You can also control the display of hidden text (along with all other
non-printing characters) by clicking on the Show/Hide tool on the toolbar.
(This is the tool that contains the paragraph symbol; it looks like a
backwards P.)

Turning off the display of hidden text presents a danger that you need to be
aware of, however. When you turn it off, it doesn't show up at all on your
screen. This makes it very easy to delete hidden text without even realizing
it. This is especially true if you delete larger blocks of text, such as
entire paragraphs.

The best way to guard against this is to make sure hidden text is always
displayed when you are developing or editing your document. In this way you
can be certain you won't inadvertently delete hidden text.


**********************************************************************
This week WORDTIPS PREMIUM subscribers also read about:

* Using the Highlighter
* Turning Off Highlighter Display
* Displaying ScreenTips
* Printing Shortcut Key Assignments

To get DOUBLE THE TIPS each week, along with valuable extra benefits,
upgrade to WORDTIPS PREMIUM. For more information, send a blank e-mail to
WTPremium@VitalNews.com or visit the following Web page:

http://store.vitalnews.com/premium.html


**********************************************************************
HELP WANTED * HELP WANTED * HELP WANTED * HELP WANTED
**********************************************************************
This section is for those having problems making Word behave. Having a
problem you want to see addressed? Send it to WTHelp@VitalNews.com.
Do you have an answer to the problems below? Send your answer to
WTAnswers@VitalNews.com (all responses become the sole property of DCI and
can be used in any way deemed appropriate). If your response is used in a
future issue, you will be credited for your contribution to the answer.


------------------------------
Changing the Height of a Font
------------------------------
The Scale control on the Character Spacing tab of the Font dialog box allows
you to adjust the horizontal scale of a font, without increasing its height.
Is there a way to do the opposite; to increase the height of the font
without changing the width? (Navin Parikh)


------------------------------
Marking Multiple Documents
------------------------------
I am looking for a way to place a mark on a document to indicate that it has
been archived. I would be doing this to many documents at a time, so I would
like to be able to bring the document up and automatically place the word
"archive" in a specific place. Any suggestions? (Glenn Todd)


**********************************************************************
PUBLISHER and COPYRIGHT INFORMATION
**********************************************************************
WordTips (ISSN 1522-3744) is published weekly by Discovery Computing Inc.
(DCI), PO Box 2145, Mesa, AZ 85214. WordTips is a trademark of DCI.
Copyright 2002 by DCI, All Rights Reserved. All broadcast, publication, or
retransmission is strictly prohibited without prior written permission from
the publisher. Full information on distribution rights can be found in the
WordTips FAQ at the WordTips Web page.


**********************************************************************
IMPORTANT LINKS * IMPORTANT LINKS * IMPORTANT LINKS
**********************************************************************

WEB ADDRESSES
-------------
WordTips Web page -

http://www.VitalNews.com/wordtips/
WordTips Premium Web page -

http://store.VitalNews.com/premium.html
WordTips Archives -

http://store.VitalNews.com/wtarch.html
Advertising in WordTips -

http://www.VitalNews.com/advert.htm
Vital News Store -

http://store.VitalNews.com/


E-MAIL ADDRESSES
---------------
Help Wanted questions - WTHelp@VitalNews.com
WordTips sample issue - WordTips-Sample@lists.vitalnews.com
WordTips Premium info - WTPremium@VitalNews.com
WordTips Archive info - WordTips-CDs@lists.vitalnews.com
Advertising in WordTips - WordTips-Advertising@lists.vitalnews.com
Editor and Publisher - awyatt@dcomp.com


**********************************************************************
SUBSCRIPTION INFORMATION * SUBSCRIPTION INFORMATION
**********************************************************************
TO RECEIVE WordTips regularly via e-mail at no charge, send an e-mail to <
join-wordtips@lists.vitalnews.com >.

You are currently subscribed to wordtips as: [sathyamurthy@netkracker.com]
To unsubscribe, forward this message to
leave-wordtips-268933P@lists.vitalnews.com

No comments:

Business Line - Markets