|
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 strGetHeaderFooterText(lngHeaderType As Long, Optional strNewText) As String
' Procedure : strGetHeaderFooterText
' Description: Return the text from the header/footer, optionally replace the text.
' Copyright: Chris Greaves Inc.
' Inputs: Header/Footer type,
' [optional new text]
' Returns: STRING of original text
' Assumes: Nothing
' Side Effects: None.
' Tested: By the calls shown below.
Call boolOpenHeaderFooter(lngHeaderType)
Selection.EndKey Unit:=wdStory, Extend:=wdExtend ' select the pane
strGetHeaderFooterText = Selection.Text ' preserve the text
If IsMissing(strNewText) Then ' Nothing else to do
Else
If Len(strNewText) = 0 Then
Selection.Delete
Else
Selection.TypeText (strNewText)
End If
End If
Call boolCloseHeaderFooter
'Sub TESTstrGetHeaderFooterText()
' MsgBox strGetHeaderFooterText(wdSeekCurrentPageHeader, "new text")
' MsgBox strGetHeaderFooterText(wdSeekCurrentPageHeader, "")
' MsgBox strGetHeaderFooterText(wdSeekCurrentPageHeader)
'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 |