Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Viewing UserForm code in Notepad

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Viewing UserForm code in Notepad

Those are saved in the file with the .frx extension. This file is a binary
file and hence cannot be viewed in notepad.

Alok Joshi

"Paul Martin" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Viewing UserForm code in Notepad

Addendum:

My intent was to see if any invalid RowSource or ControlSource values
had been set. My app has been crashing, and I suspect this may be the
reason. My thinking is that it would be easier to see this in Notepad,
than searching through the Properties Window.

  #4   Report Post  
Posted to microsoft.public.excel.programming
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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default Viewing UserForm code in Notepad

Re Paul,
For all controls properties, if you have the possibility of adding the
reference to TypeLibInformation (c:\windows\system32\tlbinf32.dll), adapt
the following code to your need:

Sub ControlsPropertiesList()
If UserForm1.Controls.Count = 0 Then Exit Sub
Cells.ClearContents
Dim oInfo As InterfaceInfo
Dim oMember As MemberInfo
Dim sProp$, i&, sVal$, Ctl As Control
For Each Ctl In UserForm1.Controls
i = i + 1
Set oInfo = InterfaceInfoFromObject(Ctl)
For Each oMember In oInfo.Members
On Error Resume Next
If oMember.InvokeKind = 4 Then
sProp = oMember.Name
sVal = CallByName(Ctl, sProp, VbGet)
Cells(i, 1) = oInfo.Name
Cells(i, 2) = sProp
Cells(i, 3) = sVal
i = i + 1
End If
Next oMember
Next Ctl
Cells.Columns.AutoFit
End Sub

Regards,
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Viewing UserForm code in Notepad

Hi Michel

Thanks again for your input.

Regards

Paul Martin
Melbourne, Australia

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Viewing Built-in Code barry New Users to Excel 4 November 19th 06 11:14 PM
Viewing a worksheet while a UserForm is active Alan Glaister[_2_] Excel Programming 2 March 8th 05 06:57 PM
UserForm Viewing Diane Alsing Excel Programming 3 February 11th 05 03:52 PM
viewing code mikeNTTA Excel Programming 1 September 23rd 04 03:51 PM
Opening Notepad from Code Stan Excel Programming 3 July 16th 04 03:18 PM


All times are GMT +1. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"