M
Marc Waesche
Hello!
I am sorry that I have more than one question.
Of cause I am happy if you can answer at least one question. The questions
concern Outlook. (the code is to find below)
1. Is it possible to add a button which opens sub-buttons when it is
pressed? In my code just a program is executed.
2. Is it possible to add the button while the target window is closed? With
this code the mail window must be opened. Otherwise I receive an error.
3. A simple question I think: How can I remove the button?
4. Is it possible to add a button to the inspector window (compose mail) if
the word editor is activated? It seems not to work in the normal way.
Sorry for so much questions!
Best regards from Germany,
Marc
Private Sub Form_Load()
Dim oApp As Object
Dim objIns As Object
Dim objCBar As Object
Dim lpobjButton As Object
'CREATE AN INSTANCE OF THE OUTLOOK APPLICATION OBJECT
Set oApp = CreateObject("Outlook.Application")
Set objIns = oApp.ActiveInspector
Set objCBar = objIns.CommandBars
'CREATE THE ACTUAL BUTTON IN OUTLOOK
Set lpobjButton = objCBar.Item("Standard").Controls.Add()
lpobjButton.Caption = "test"
'ENABLE THE BUTTON TO CALL ANOTHER EVENT
lpobjButton.HyperlinkType = 1
lpobjButton.ToolTipText = "c:\program files\test\test.exe"
Set lpobjButton = Nothing
Set oApp = Nothing
End
End Sub
I am sorry that I have more than one question.
Of cause I am happy if you can answer at least one question. The questions
concern Outlook. (the code is to find below)
1. Is it possible to add a button which opens sub-buttons when it is
pressed? In my code just a program is executed.
2. Is it possible to add the button while the target window is closed? With
this code the mail window must be opened. Otherwise I receive an error.
3. A simple question I think: How can I remove the button?
4. Is it possible to add a button to the inspector window (compose mail) if
the word editor is activated? It seems not to work in the normal way.
Sorry for so much questions!
Best regards from Germany,
Marc
Private Sub Form_Load()
Dim oApp As Object
Dim objIns As Object
Dim objCBar As Object
Dim lpobjButton As Object
'CREATE AN INSTANCE OF THE OUTLOOK APPLICATION OBJECT
Set oApp = CreateObject("Outlook.Application")
Set objIns = oApp.ActiveInspector
Set objCBar = objIns.CommandBars
'CREATE THE ACTUAL BUTTON IN OUTLOOK
Set lpobjButton = objCBar.Item("Standard").Controls.Add()
lpobjButton.Caption = "test"
'ENABLE THE BUTTON TO CALL ANOTHER EVENT
lpobjButton.HyperlinkType = 1
lpobjButton.ToolTipText = "c:\program files\test\test.exe"
Set lpobjButton = Nothing
Set oApp = Nothing
End
End Sub