Hi!

Though I've made a couple of attempts at this, I have yet to figure out how
to create a macro that does the following.

1. Determine the style of the paragraph in which the cursor is sitting.
2. Compare the style determined in step 1 to a short list of style names. If
the style = A, change the style of the paragraph in which the cursor is
sitting to A1;if the style = B, change to B1, and so on.
3. If the style is not equal to one that is on the list, return an error
message.

ANybody have something liek this I can look at or some suggestions about how
to create this macro?

Thanks!

Beth

Re: Macro to change style based on style of current paragraph by Doug

Doug
Fri Feb 10 13:16:17 CST 2006

If the list is not too long, you could use something like

Dim stylename As String
With Selection.Paragraphs(1)
stylename = .Style
If stylename = "A" Then
.Style = "A1"
ElseIf stylename = "B" Then
.Style = "B1"
Else
MsgBox "Style not in List"
End If
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Beth Brooks" <BethBrooks@discussions.microsoft.com> wrote in message
news:3D0A5D42-FC4C-414A-A70C-C58F2D72A3F1@microsoft.com...
> Hi!
>
> Though I've made a couple of attempts at this, I have yet to figure out
> how
> to create a macro that does the following.
>
> 1. Determine the style of the paragraph in which the cursor is sitting.
> 2. Compare the style determined in step 1 to a short list of style names.
> If
> the style = A, change the style of the paragraph in which the cursor is
> sitting to A1;if the style = B, change to B1, and so on.
> 3. If the style is not equal to one that is on the list, return an error
> message.
>
> ANybody have something liek this I can look at or some suggestions about
> how
> to create this macro?
>
> Thanks!
>
> Beth



Re: Macro to change style based on style of current paragraph by BethBrooks

BethBrooks
Fri Feb 10 14:47:27 CST 2006

Doug,

That worked like a charm. Thanks!

Beth