colinmitton
Technical User
I'm trying to create a macro to adjust some styles in a word 2003 document. I have succesfully created macro that adjusts a single or multiple style(s) in a document as long as they are there. If the Style is not there it crashes and goes in to debug mode.
So to combate this I'm trying to set it up to check if the style exists and if it does adjust the style if not the skip on to the next style.
I looked around a few sites and tried these two solutions but both fail, my idea being setup a macro to change each (individual) style to how we need it, then to have a macro to check for all style and if that style exists to run the macro to change that style. I used the following two ways but both kept giving me errors.
Sub checkstyle1()
If Style.Exists("Style1") = True Then
Application.Run MacroName:="Normal.NewMacros.changestyle1"
End If
End Sub
And
Sub checkstyle1()
If Style("Style1").InUse = True Then
Application.Run MacroName:="Normal.NewMacros.changestyle1"
End If
End Sub
I'm sure theres an easier way or I'm missing something really simple!
Thanks in Advance.
So to combate this I'm trying to set it up to check if the style exists and if it does adjust the style if not the skip on to the next style.
I looked around a few sites and tried these two solutions but both fail, my idea being setup a macro to change each (individual) style to how we need it, then to have a macro to check for all style and if that style exists to run the macro to change that style. I used the following two ways but both kept giving me errors.
Sub checkstyle1()
If Style.Exists("Style1") = True Then
Application.Run MacroName:="Normal.NewMacros.changestyle1"
End If
End Sub
And
Sub checkstyle1()
If Style("Style1").InUse = True Then
Application.Run MacroName:="Normal.NewMacros.changestyle1"
End If
End Sub
I'm sure theres an easier way or I'm missing something really simple!
Thanks in Advance.