View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Dump Utility for User form Application

Hi Jim,

The extra code that I gave you uses the Microsoft Visual Basic For
Application Extensibility library. The code uses some constants in that
library, so you can set a reference to that library in the VBIDE, or you can
use late binding where you replace the constants with the actual value. What
I do is add code similar to the lines that you mention that do conditional
compilation, #If Not EarlyBound Then, and creates my own constants with the
same names and the appropriate values.

What this all means is that by including this code at the start of the
module, after any Option declarations but before any procedures, I can
either have my code late binding by doing nothing else, or I can have my
code early binding, by adding a reference to that library and by adding
another line before these lines of

#Const EarlyBound = True

To be absolutely factual, the code should read

#Const EarlyBound = False

#If Not EarlyBound Then
Const vbext_ct_StdModule As Long = 1
Const vbext_ct_ClassModule As Long = 2
Const vbext_ct_MSForm As Long = 3
#End If


'----------------------------------------------------------------
Sub ShowMyControls()
'----------------------------------------------------------------
#If Not EarlyBound Then
Dim ovbmod As Object
#Else
Dim ovbmod As VBIDE.VBComponent
#End If
Dim i As Long
Dim sh As Worksheet

On Error Resume Next
Set sh = Worksheets("Report of Controls")
If sh Is Nothing Then
Set sh = Worksheets.Add
sh.Name = "Report of Controls"
Else
sh.Cells.ClearContents
sh.Activate
End If
With sh
.Range("A4").Value = "FormName"
.Range("B4").Value = "TypeControl"
.Range("C4").Value = "ControlName"
.Range("D4").Value = "ControlCaption"
.Range("E4").Value = "ControlValue"
.Range("A4:E4").Font.Bold = True
.Range("A4:E4").HorizontalAlignment = xlCenter
.Range("A5").Select
End With
i = 4

With ActiveWorkbook.VBProject
For Each ovbmod In .VBComponents
Select Case ovbmod.Type
Case vbext_ct_StdModule:
Case vbext_ct_MSForm:
i = i + 1
myControls ovbmod.Name, sh, i
Case vbext_ct_ClassModule:
End Select
Next ovbmod
End With

End Sub

I can then just flip the constant as required
--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:7mT8f.31495$OM4.7158@dukeread06...
Bob,
Thanks for your help on this "project";
Sorry for the "back and forth" action,,
But you helped me immensely..

Haven't totally utilized you last suggestion which
reports on ALL userforms (cause I didn't know
what to do with the lines:)

#If Not EarlyBound Then
Const vbext_ct_StdModule As Long = 1
Const vbext_ct_ClassModule As Long = 2
Const vbext_ct_MSForm As Long = 3
#End If

appearing before the normal code.
Can you specify (what to do with it - with explaination)..
Jim May