PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins Adding a button to the Appointment Form

Reply

Adding a button to the Appointment Form

 
Thread Tools Rate Thread
Old 14-03-2006, 07:55 AM   #1
cookiesncreamychoc@hotmail.com
Guest
 
Posts: n/a
Default Adding a button to the Appointment Form


Hi Ppl,

I really really need help this time......
Could you please tell me what is wrong with the code below:

Private Sub oInspector_NewInspector(ByVal Inspector As
Microsoft.Office.Interop.Outlook.Inspector) Handles
oInspector.NewInspector
Try
oAppointment = CType(Inspector.CurrentItem,
AppointmentItem)
'SetCommandBars(oAppointment)
Dim oCommandBars As CommandBars
'Outlook has the CommandBars collection on the Explorer
object.
oCommandBars = oAppointment.GetInspector.CommandBars
'In case the button was not deleted, use the exiting one.
'Try
'Toolbox = CType(oCommandBars("Standard").Controls("Int"),
CommandBarButton)
'Catch
'If btnToolbox Is Nothing Then
btnToolbox = CType(oCommandBars("Standard").Controls.Add(1,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value),
CommandBarButton)
With btnToolbox
.Caption = "Toolbox Details"
.Style = MsoButtonStyle.msoButtonCaption
.Tag = "Toolbox Details"
.OnAction = "!<IntOutlook.Connect>"
.Visible = True
End With
'End If
'End Try

Catch
'not an Appointment
End Try
End Sub

All I want to do is add a button in the Standard toolbar of the
Appointment form....

Desperate for help.....
Thanx

  Reply With Quote
Old 14-03-2006, 03:48 PM   #2
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Adding a button to the Appointment Form

And what happens? Any errors?

Normally you would want to make sure that the item is an appointment before
doing the rest of the code. That can be done by checking the Class of
Inspector.CurrentItem.

I also usually defer creating my buttons in an Inspector until the first
Activate event fires for that Inspector.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<cookiesncreamychoc@hotmail.com> wrote in message
news:1142322957.458193.222360@i39g2000cwa.googlegroups.com...
> Hi Ppl,
>
> I really really need help this time......
> Could you please tell me what is wrong with the code below:
>
> Private Sub oInspector_NewInspector(ByVal Inspector As
> Microsoft.Office.Interop.Outlook.Inspector) Handles
> oInspector.NewInspector
> Try
> oAppointment = CType(Inspector.CurrentItem,
> AppointmentItem)
> 'SetCommandBars(oAppointment)
> Dim oCommandBars As CommandBars
> 'Outlook has the CommandBars collection on the Explorer
> object.
> oCommandBars = oAppointment.GetInspector.CommandBars
> 'In case the button was not deleted, use the exiting one.
> 'Try
> 'Toolbox = CType(oCommandBars("Standard").Controls("Int"),
> CommandBarButton)
> 'Catch
> 'If btnToolbox Is Nothing Then
> btnToolbox = CType(oCommandBars("Standard").Controls.Add(1,
> System.Reflection.Missing.Value, System.Reflection.Missing.Value,
> System.Reflection.Missing.Value, System.Reflection.Missing.Value),
> CommandBarButton)
> With btnToolbox
> .Caption = "Toolbox Details"
> .Style = MsoButtonStyle.msoButtonCaption
> .Tag = "Toolbox Details"
> .OnAction = "!<IntOutlook.Connect>"
> .Visible = True
> End With
> 'End If
> 'End Try
>
> Catch
> 'not an Appointment
> End Try
> End Sub
>
> All I want to do is add a button in the Standard toolbar of the
> Appointment form....
>
> Desperate for help.....
> Thanx
>


  Reply With Quote
Old 14-03-2006, 03:54 PM   #3
Rog
Guest
 
Posts: n/a
Default Re: Adding a button to the Appointment Form

I use C# for my addins and looking at this line:
CType(oCommandBars("Standard").Controls.Add(1,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value),
CommandBarButton)
usually the last parameter is true or false for temporary or not.
Rog

cookiesncreamychoc@hotmail.com wrote:
> Hi Ppl,
>
> I really really need help this time......
> Could you please tell me what is wrong with the code below:
>
> Private Sub oInspector_NewInspector(ByVal Inspector As
> Microsoft.Office.Interop.Outlook.Inspector) Handles
> oInspector.NewInspector
> Try
> oAppointment = CType(Inspector.CurrentItem,
> AppointmentItem)
> 'SetCommandBars(oAppointment)
> Dim oCommandBars As CommandBars
> 'Outlook has the CommandBars collection on the Explorer
> object.
> oCommandBars = oAppointment.GetInspector.CommandBars
> 'In case the button was not deleted, use the exiting one.
> 'Try
> 'Toolbox = CType(oCommandBars("Standard").Controls("Int"),
> CommandBarButton)
> 'Catch
> 'If btnToolbox Is Nothing Then
> btnToolbox = CType(oCommandBars("Standard").Controls.Add(1,
> System.Reflection.Missing.Value, System.Reflection.Missing.Value,
> System.Reflection.Missing.Value, System.Reflection.Missing.Value),
> CommandBarButton)
> With btnToolbox
> .Caption = "Toolbox Details"
> .Style = MsoButtonStyle.msoButtonCaption
> .Tag = "Toolbox Details"
> .OnAction = "!<IntOutlook.Connect>"
> .Visible = True
> End With
> 'End If
> 'End Try
>
> Catch
> 'not an Appointment
> End Try
> End Sub
>
> All I want to do is add a button in the Standard toolbar of the
> Appointment form....
>
> Desperate for help.....
> Thanx
>

  Reply With Quote
Old 15-03-2006, 12:21 AM   #4
cookiesncreamychoc@hotmail.com
Guest
 
Posts: n/a
Default Re: Adding a button to the Appointment Form

Thanks Ken....
U r a star with (an) Outlook

  Reply With Quote
Old 15-03-2006, 12:21 AM   #5
cookiesncreamychoc@hotmail.com
Guest
 
Posts: n/a
Default Re: Adding a button to the Appointment Form

Thanks Ken....
U r a star with (an) Outlook

  Reply With Quote
Old 21-03-2006, 12:36 AM   #6
cookiesncreamychoc@hotmail.com
Guest
 
Posts: n/a
Default Re: Adding a button to the Appointment Form

I am trying to delete the button in the Inspector Close event but it
doesnot seem to be working.
oCommandBars("Standard").Controls("Opportunities").Delete(System.Reflection.Missing.Value)

The button has been designed to only load for the Appointment Items.
I'm sure it is not being deleted because when I create a new mail
message it is not visible but once I create an appointment and reopen
the mail message the button is available in the standard toolbar.

Suggestions?

Thanx

  Reply With Quote
Old 21-03-2006, 02:09 PM   #7
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Adding a button to the Appointment Form

Delete really shouldn't be needed if you create the button as Temporary :=
True.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<cookiesncreamychoc@hotmail.com> wrote in message
news:1142901359.952828.30090@i40g2000cwc.googlegroups.com...
>I am trying to delete the button in the Inspector Close event but it
> doesnot seem to be working.
> oCommandBars("Standard").Controls("Opportunities").Delete(System.Reflection.Missing.Value)
>
> The button has been designed to only load for the Appointment Items.
> I'm sure it is not being deleted because when I create a new mail
> message it is not visible but once I create an appointment and reopen
> the mail message the button is available in the standard toolbar.
>
> Suggestions?
>
> Thanx
>


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off