|
Visual Basic (VB and VBA) |
|
Copyright 1999-2001 Christopher Greaves. All rights reserved. Home Page and email to [email protected] |
| If in doubt, record a macro and inspect the entrails! |
Please read the DISCLAIMER.
Here is an INDEX to all the procedures.
You will probably need one copy of my GLOBAL DECLARATIONS.
Public Function boolStyleInDocument(strStylename As String, strDoc As String) As Boolean
' Procedure : boolStyleInDocument
' Description: Returns TRUE if the style is in the named document.
' By: Chris Greaves Inc.
' Inputs: A style name.
' A document name
' Returns: Boolean
' Assumes: Nothing
' Side Effects: None.
' Tested: by the calls shown below.
boolStyleInDocument = False
Selection.Find.ClearFormatting
On Error GoTo Failed
Selection.Find.Style = ActiveDocument.Styles(strStylename) ' 2000/10/25 fails 5941
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
boolStyleInDocument = Selection.Find.Execute
Selection.Find.ClearFormatting
Failed:
'Sub TESTboolStyleInDocument()
'MsgBox boolStyleInDocument("Normal", ActiveDocument.Name)
'MsgBox boolStyleInDocument("normal", ActiveDocument.Name)
'MsgBox boolStyleInDocument("Normal2", ActiveDocument.Name)
'End Sub
End Function
| We all knew nothing when we started … |
|
Home Page and Contact Information Send email to [email protected]. This page was last updated Thursday, November 15, 2001 |