Is this possible?

R

Ruth

I have recorded a macro to copy a style from Normal.dot to
the active document:

Application.OrganizerCopy Source:= _
"C:\Program Files\MacPac\Personal\Normal.dot",
Destination:= _
"C:\Documents and Settings\RCar\Desktop\sample
template.dot", Name:= _
"cs", Object:=wdOrganizerObjectStyles

But how can I adjust this macro to copy only styles that
begin with the prefix "PER"?

Can anyone help?
Greatly appreciated!
Ruth
 
H

Helmut Weber

Hi Ruth,
here is one example for copying all styles
whose names start with "00-" from a dot to
the activedocument.
---
There may be other and better ways.
---
Dim oDot As Document
Set oDot = Documents.Open("c:\editx\ap-beitrag.dot", _
Visible:=False)
Dim aStyle As Style
For Each aStyle In oDot.Styles
If Left(aStyle.NameLocal, 3) = "00-" Then
Application.OrganizerCopy Source:=oDot.FullName, _
Destination:=ActiveDocument.FullName, _
Name:=aStyle.NameLocal, _
Object:=wdOrganizerObjectStyles
End If
Next
oDot.Close
Set oDot = Nothing
 

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