jasonphillipstx
Technical User
I get an error when running the following code in outlook 2003. When I comment out the .OnAction line all works as intended. With it in, I get runtime error 438. object doesn;t support this property or method. Can someone help me with this one?
Code:
Public Sub EnumButtons()
Dim i As Integer
Dim cnt As Integer
Set olapp = Outlook.Application.ActiveExplorer
Set objcb = olapp.CommandBars("Standard")
Set objbut = objcb.Controls
cnt = objbut.Count
Debug.Print cnt
i = 1
Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim f1
Set f1 = fso.CreateTextFile("c:\buttons.txt", True)
Do While i <= cnt
With objbut(i)
f1.Write i & " - " & .Caption
f1.WriteBlankLines (1)
f1.Write " OnAction = " & .OnAction ' <-----this is the line that gives me the error
f1.WriteBlankLines (1)
f1.Write " Parameter = " & .Parameter
f1.WriteBlankLines (2)
End With
i = i + 1
Loop
f1.Close
Set olapp = Nothing
'open txt file
Set sh = CreateObject("WScript.Shell")
sh.Run "c:\buttons.txt"
End Sub