Adding new style 2 macro

S

Sasa

I have problem with creating new style into my macro.
When I try it, Word told me that requested member of
collection does not exist. Please tell me where is mistake.
Here is my code:

Dim NewStyle As Style
Set NewStyle = ActiveDocument.Styles("Normal + Courier _
New, 18 pt, Bold, Custom Color(RGB(0,51,255))")

For Each NewStyle In ActiveDocument.Styles
..
..
..
..
Next

Thank you.

Sasa
 
H

Helmut Weber

Hi Sasa,
the add-Methode is missing!
with activedocument.styles
Set NewStyle = .Add("Standard" & " Courier New")
end with
Of course, this works only once, as you can't add
a style with the same name twice.

Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, W98
 

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