Re: Problem with CommandBarComboBox Change Event (Event fires only once)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Make sure your references are staying alive and aren't being eaten by the
garbage collector. Set a module or global reference to things so they aren't
collected.

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


"M. Khalid Farooq" <khalid@xxxxxxxxxxx> wrote in message
news:ezHXaY38GHA.940@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I am having a problem with CommandBarComboBox's Change Event. I have added
a toolbar in New Email Item Inspector. It shows few CommandBarButton and one
Combo box. On ComboBox Change event, I have to set a custom HTML Contents
for the current mail item body.

My problem is that everything works perfect for the first time. I got
Combo Box. On Selecting an item I got body changed to what I desire. However
it doesn't fire Change Event on next selection. I want to make it change
body whenever user changes selection in the Combo Box. Here is the Code as
how I added this ComboBox,

Private Sub templateComboBox_Change(ByVal Ctrl As
Microsoft.Office.Core.CommandBarComboBox) Handles templateComboBox.Change

Try

Me.m_olMailItem.HTMLBody = "<html><body><b>" + Ctrl.Text +
"</b></body></html>"

Catch ex As Exception

MsgBox(ex.Message)

End Try

End Sub


There comes no exception and it works fine for first selection. On second
or later selections there is neither any change in the body nor any
exception came out. Please help me to understand whats wrong with it.

Thanks,

Khalid


Relevant Pages

  • RE: Ok to call Application.get_Selection()?
    ... We get an exception that says COMException ... Cannot create a Selection object when this dialog is active. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.office.developer.com.add_ins)
  • origin of error message
    ... i was trying to create an image using user selection of a file in tix ... Exception exceptions.AttributeError: "PhotoImage instance has no ...
    (comp.lang.python)
  • RE: problem in changing part of a sentence
    ... You originally wrote that you are seeing an exception in your call to ... But when I call "Select" on it the resulted selection will be the ... supplying in your calls to MoveStart and MoveEnd. ...
    (microsoft.public.word.vba.general)
  • RE: problem in changing part of a sentence
    ... it will cause the exception to occur. ... But when I call "Select" on it the resulted selection will be the ... supplying in your calls to MoveStart and MoveEnd. ...
    (microsoft.public.word.vba.general)
  • Re: Getting selected TextRange
    ... whether the current selection is Slides, Shapes, Text or nothing. ... BoundLeft and .BoundWidth will increase by equal amounts. ... Because sel.TextRange throws an exception when getting some properties ... Cubicle Wars - http://www.windwardreports.com/film.htm ...
    (microsoft.public.powerpoint)