|
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 lngClearModuleText(strDoc As String, strModule As String) As Long
' Procedure : lngClearModuleText
' Description: .
' By: Chris Greave
' Inputs: A document name and a module name,
' Action: Clear all the text lines from the module.
' Returns: The count of lines deleted.
' Assumes: The document is open and the module exists.
' Side Effects: None.
' Tested: by the calls shown below.
lngClearModuleText = 0 ' default is zero for failure
Dim intComp As Integer ' index of COMPonents
For intComp = 1 To Documents(strDoc).VBProject.VBComponents.Count
If UCase(Documents(strDoc).VBProject.VBComponents(intComp).Name) = UCase(strModule) Then
Dim intLines As Integer ' index of LINES in our particular component
lngClearModuleText = Documents(strDoc).VBProject.VBComponents(intComp).CodeModule.CountOfLines
For intLines = Documents(strDoc).VBProject.VBComponents(intComp).CodeModule.CountOfLines To 1 Step -1
Documents(strDoc).VBProject.VBComponents(intComp).CodeModule.DeleteLines (intLines)
Next intLines
Else
End If
Next intComp
'Private Sub TESTlngClearModuleText()
'MsgBox lngClearModuleText("Eraseme.doc", "uhghiddentext")
'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 |