Paragraph-formatting macro clashing with style

G

Guest

I have created keyboard short-cuts for a number of styles, all of them in the
<Ctrl + Alt + x> format. I have also created a macro to apply Keep With Next
to a paragraph, also with a keyboard short-cut in the same format. When I use
the KWN short-cut, the style of the paragraph is corrupted by the importation
of the indents of one particular (uncommon) style in the template (to the
best of my knowledge, not associated with the creation of the macro, i.e.
although a relevant document was open at the time, the cursor would not have
been in a passage in the offending style). This occurs whether the style was
applied using the mouse or the keyboard short-cut but, if I apply KWN using
the mouse, the corruption does not occur.
 
S

Shauna Kelly

Hi

First, let's make absolutely sure that KWN is the problem. If you do Format
Paragraph and tick Keep With Next, do you get the same problems? If there
are no problems there, we know it's either the keyboard shortcut or the
macro.

Next, let's make absolutely sure that the keyboard shortcut is running the
macro. Do Tools > Macro > Macros. Find your macro and click Run.

Do you get the same problems? If so, post back and paste the code of the
macro (everything from Sub to End Sub) in your message.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
S

Suzanne S. Barnhill

The problem with macros recording paragraph formatting is that they record
*everything* in the Format Paragraph dialog, which is doubtless the problem
with your macro. Fortunately, however, no macro is required to apply the
Keep with Next formatting. In the Customize dialog, click on Keyboard and
select All Commands. Locate the ParaKeepWithNext command and assign your
keyboard shortcut. You can also drag this command (from the Commands tab) to
a toolbar if desired (that's what I have done).

For more on the shortcomings of recorded macros (and how to get around
them), see http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Guest

Thank you, Shauna, for these comments. While they are partly superseded by
Suzanne's post, I include the interlined comments below (in caps) 'in the
interests of science'. More follows in my reply to Suzanne's post.
 
G

Guest

As indicated in my reply to Shauna, your diagnosis seems to be correct. I
seized upon your suggestion below with glee. I deleted the macro and then
applied the short-cut in the manner suggested. Wonderful!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top