btw, this code does find the weird style but can not delete it. I
think this line: WordStyle.Delete()  needs to be changed to something
else.


On Aug 18, 11:46 am, Cerebrus <[email protected]> wrote:
> It should be pretty obvious...
>
> ---
> Dim s as String
> ---
>
> On Aug 17, 9:58 pm, MM <[email protected]> wrote:
>
>
>
> > thank you - but I can't use Trim the way it is used in your code - it
> > says 'Trim' is not the member of 'System.Array'
>
> > any suggestion?
>
> > On Aug 17, 12:39 pm, Cerebrus <[email protected]> wrote:
>
> > > Perhaps :
>
> > > s = WordStyle.NameLocal
> > > If s.Trim().EndsWith("char", StringComparison.OrdinalIgnoreCase) Then
> > >   WordStyle.Delete()
> > > ...
>
> > > On Aug 17, 9:16 pm, MM <[email protected]> wrote:
>
> > > > Hi,
>
> > > > The code below checks the styles in a word document against the styles
> > > > in a template that is to be applied - then it will get rid of all
> > > > styles in my document that are not in the template - it also deletes
> > > > variation of styles that were inadvertently created in my docuemtn
> > > > (i.e "style_name Char"). Up to here all is fine, however, the
> > > > challenge starts when for some unknown reasons invalid styles in the
> > > > form of a space and Char ("  CHAR") creeps into my document. The code
> > > > below is not able to catch this specific invalid style. Can someone
> > > > tell me how to modify this code in order to catch the mentioned
> > > > invalid style. thank you.
>
> > > > 'delete the style if its not from the template
> > > >                         Dim s() As String
> > > >                         app.Events.Write(WordStyle.NameLocal)
> > > >                         s = WordStyle.NameLocal.Split(" ")
> > > >                         If UCase(s(s.Length - 1)) = "CHAR" Then
> > > >                             WordStyle.Delete()
> > > >                         ElseIf Not ok Then
> > > >                             WordStyle.Delete()
> > > >                         End If- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to