Remove aliases names from styles

A

andreas

Dear Experts:

I have got a document where the user has created a lot of aliases
names for styles such as

Heading 6;hd6 or
bodytext;bd

I would like to delete those aliases names in one go using VBA.

Is this possible?

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
 
H

Helmut Weber

Hi Andreas,

try something like that:

Sub Test7c()
Dim s As Style
For Each s In ActiveDocument.Styles
If InStr(s, ";") Then
s = Mid(s, 1, InStr(s, ";"))
End If
Next
End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
A

andreas

Hi Andreas,

try something like that:

Sub Test7c()
Dim s As Style
For Each s In ActiveDocument.Styles
   If InStr(s, ";") Then
   s = Mid(s, 1, InStr(s, ";"))
   End If
Next
End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP


Hey Helmut,

as always, thank you very much for your terrific help. Nice coding.
Regards, Andreas
 

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