i am trying to Execute some command Bar Button but doesn't work

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi there,

i am trying to Execute some command Bar Button i can change if there
Visible, Enabled and Caption of them but i can't Execute them and i don;t
know why is it becuase i am using VB.net and the COM add-in dll uses VB 6??
below is my code in case i am doing some think wrong? i put the some code in
to VBA in word and it works and does the Execute fine so that shows that the
COM add-in works i did that in word 2003 and the COM ADD-IN is for Outlook
2003?

What do i need to change or doing wrong?


DocumentsButton() As Office.CommandBarButton

ProcessButton() As Office.CommandBarButton


Code:
Dim oCM As Object
Set olApp = CreateObject("Outlook.Application")

Set oCM = olApp.COMAddIns.Item("OutlookCRM.Connect").Object


oCM.ContactComboBox.Text = "da"
'MsgBox (oCM.ProjectButton.TooltipText)

oCM.ProcessMode = 2
MsgBox(oCM.Control.ProcessButton.Visible)
MsgBox(oCM.Control.ProcessButton.Enabled)

oCM.Control.DocumentsButton.Visible = True
oCM.Control.DocumentsButton.Enabled = True
oCM.Control.DocumentsButton.Execute()


oCM.Control.DocumentsButton.Visible = True
oCM.Control.DocumentsButton.Enabled = True
oCM.Control.DocumentsButton.Execute()
 
Execute is just a method of the CommandBarButton. If you get a valid button
object and can use .Visible and so on without errors there should be no
reason you can't call the Execute method.

Are you getting a valid button object? Are there any errors when you call
..Execute?
 
Back
Top