IsStyleExisting, prüfen, ob eine Formatvorlage vorhanden ist
(Word, VBA)
Function isStyleExisting(pstrStyle As String) As Boolean
'{ Prozedurkopf ==============
'Autor: Michael Abendroth
'Datum: 01.02.2010
'Beschreibung: Prüft, ob eine Formatvorlage im Worddokument vorhanden ist
'Parameter: pstrStyle:=Zu suchende Formatvorlage
'Rückgabe: True/False
'} Prozedurkopf ==============
On Error Resume Next
Dim objStyles As Object
Set objStyles = ActiveDocument.Styles(pstrStyle)
If Err.Number <> 0 Then
isStyleExisting = False
Else
isStyleExisting = True
End If
Err.Clear
Set objStyles = Nothing
End Function