View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Michel Pierron Michel Pierron is offline
external usenet poster
 
Posts: 214
Default Viewing UserForm code in Notepad

Hi Paul,
For the UserForm properties, you can try:

Sub UserFormProperties()
Dim vbProj As Object, F%, i%
Set vbProj = ThisWorkbook.VBProject
Set Application.VBE.ActiveVBProject = vbProj
Application.Visible = 1
Windows(ThisWorkbook.Name).Activate
DoEvents
F = FreeFile
Open "c:\MyFile.txt" For Output As #F
On Error Resume Next
With ThisWorkbook.VBProject.VBComponents("UserForm1")
For i = 1 To .Properties.Count
Print #F, .Properties(i).Name & vbTab & .Properties(i).Value
Next i
End With
Close #F
Set vbProj = Nothing
Shell "c:\windows\notepad.exe c:\myfile.txt", 1
End Sub

MP

"Paul Martin" a écrit dans le message de news:
...
Hi all

If I export a Form Module to my desktop and open it in Notepad, I can
see how VBA writes the properties of the UserForm such as Height, Left,
StartUpPosition, etc.

Is there any way that I can (in Notepad) also view all the properties
of all the controls on the UserForm?

Thanks in advance

Paul Martin
Melbourne, Australia