PC Review


Reply
Thread Tools Rate Thread

Debug com addin

 
 
Hans Börjesson
Guest
Posts: n/a
 
      18th Nov 2003
Hi!

I have a VB6 Outlook Com addin and I have problems when I try to debug my
code. When starting Outlook my code to add/delete a commandbar always raises
an exception that does not make it possible to debug any more. If I don't
debug everything works fine (commanbars are added/deleted OK).

For Each oCommandBar In m_objExpl.CommandBars
If oCommandBar.Name = "VendimoToolbar" Then
For i = 1 To oCommandBar.Controls.Count
oCommandBar.Controls.Item(i).Delete False
Next i
oCommandBar.Delete
End If
Next oCommandBar

I get error 13 Type missmatch (oCommandBar is declared As
Office.CommandBar).

My VB project is set to binary compability and it is pointing att the right
dll file.

Plattform: W2000 proffesional, Outlook 2000 SR1.

Regards
/Hans


 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      18th Nov 2003
You should always delete items from a collection using a count down
loop so the loop counter doesn't get confused:
For i = m_objExpl.CommandBars.Count To 1 Step -1
Set oBar = m_objExpl.CommandBars.Item(i)
oBar.Delete
Next i

You also should use a unique Tag property if the CommandBar is user
created instead of using a name, which might be duplicated. For
example the Actions menu is duplicated in the "Menu Bar" CommandBar
collection.

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


"Hans Börjesson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi!
>
> I have a VB6 Outlook Com addin and I have problems when I try to

debug my
> code. When starting Outlook my code to add/delete a commandbar

always raises
> an exception that does not make it possible to debug any more. If I

don't
> debug everything works fine (commanbars are added/deleted OK).
>
> For Each oCommandBar In m_objExpl.CommandBars
> If oCommandBar.Name = "VendimoToolbar" Then
> For i = 1 To oCommandBar.Controls.Count
> oCommandBar.Controls.Item(i).Delete False
> Next i
> oCommandBar.Delete
> End If
> Next oCommandBar
>
> I get error 13 Type missmatch (oCommandBar is declared As
> Office.CommandBar).
>
> My VB project is set to binary compability and it is pointing att

the right
> dll file.
>
> Plattform: W2000 proffesional, Outlook 2000 SR1.
>
> Regards
> /Hans
>
>



 
Reply With Quote
 
Hans Börjesson
Guest
Posts: n/a
 
      18th Nov 2003
Hi Ken!

I have tested with this earlier (and I tried it now once again) and I get
exception anyway "Method 'item' of _commandbars failed. If I debug the
m_objExpl.CommandBars.Count it seems to show the right number of elements.
If I did not call my function to delete my toolbar (which I actually think I
don't have to call since I use the temporary=true when I create the toolbar)
it fails when I try do add my commandbar with error Interface not
registered.

There must be something corrupt with my registry but I don't understan why
it works when I run the dll and not when I run via VB.

Set oCommandBar = m_objExpl.CommandBars.Add("VendimoToolbar", , , True)
oCommandBar.Visible = True
oCommandBar.Enabled = True
oCommandBar.Position = msoBarTop

Set oCmdExplorerBtn = oCommandBar.Controls.Add(msoControlButton, , , ,
True)
oCmdExplorerBtn.Caption = g_xml.WriteTextValue("msg_028")
oCmdExplorerBtn.Enabled = True
oCmdExplorerBtn.Visible = True
oCmdExplorerBtn.Tag = GetNewGuid
m_btoolbarsAdded = True


Regards
/Hans


 
Reply With Quote
 
John Covert
Guest
Posts: n/a
 
      19th Nov 2003
Hans,

You and I have hit similar issues (and ones for which I see no other entries
on any newsgroup).

My issue can be found here:

http://groups.google.com/groups?hl=e...ndBars&spell=1

I will let you know what I find out if anything. I figure I have three more
days and then I need to take my machine,
put it on the workbench and reinstall everything from OS up.

Dreadful.

John






"Hans Börjesson" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi Ken!
>
> I have tested with this earlier (and I tried it now once again) and I get
> exception anyway "Method 'item' of _commandbars failed. If I debug the
> m_objExpl.CommandBars.Count it seems to show the right number of elements.
> If I did not call my function to delete my toolbar (which I actually think

I
> don't have to call since I use the temporary=true when I create the

toolbar)
> it fails when I try do add my commandbar with error Interface not
> registered.
>
> There must be something corrupt with my registry but I don't understan why
> it works when I run the dll and not when I run via VB.
>
> Set oCommandBar = m_objExpl.CommandBars.Add("VendimoToolbar", , , True)
> oCommandBar.Visible = True
> oCommandBar.Enabled = True
> oCommandBar.Position = msoBarTop
>
> Set oCmdExplorerBtn = oCommandBar.Controls.Add(msoControlButton, , , ,
> True)
> oCmdExplorerBtn.Caption = g_xml.WriteTextValue("msg_028")
> oCmdExplorerBtn.Enabled = True
> oCmdExplorerBtn.Visible = True
> oCmdExplorerBtn.Tag = GetNewGuid
> m_btoolbarsAdded = True
>
>
> Regards
> /Hans
>
>



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      19th Nov 2003
Early versions of Outlook 2000 do need you to explicitly delete the
commandbar even if declared as temporary. Otherwise you sometimes end
up with a lot of those temporary buttons.

I'm really not sure why the code is working in run mode and not in
debug mode. I haven't seen that and other than John's similar problem
I haven't heard of it before. Sorry I can't be of more help in this.
The only other thing I can think of is to install VB on another
machine and see if it displays the same debug mode problems.

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


"Hans Börjesson" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi Ken!
>
> I have tested with this earlier (and I tried it now once again) and

I get
> exception anyway "Method 'item' of _commandbars failed. If I debug

the
> m_objExpl.CommandBars.Count it seems to show the right number of

elements.
> If I did not call my function to delete my toolbar (which I actually

think I
> don't have to call since I use the temporary=true when I create the

toolbar)
> it fails when I try do add my commandbar with error Interface not
> registered.
>
> There must be something corrupt with my registry but I don't

understan why
> it works when I run the dll and not when I run via VB.
>
> Set oCommandBar = m_objExpl.CommandBars.Add("VendimoToolbar", , ,

True)
> oCommandBar.Visible = True
> oCommandBar.Enabled = True
> oCommandBar.Position = msoBarTop
>
> Set oCmdExplorerBtn = oCommandBar.Controls.Add(msoControlButton, ,

, ,
> True)
> oCmdExplorerBtn.Caption = g_xml.WriteTextValue("msg_028")
> oCmdExplorerBtn.Enabled = True
> oCmdExplorerBtn.Visible = True
> oCmdExplorerBtn.Tag = GetNewGuid
> m_btoolbarsAdded = True
>
>
> Regards
> /Hans
>
>



 
Reply With Quote
 
Hans Börjesson
Guest
Posts: n/a
 
      19th Nov 2003
Thanks Ken!

I received a new version of redemption.dll today and my problem original
problem disappeared with the new dll so I do no longer have to debug my code
anymore (even if It would be nice to have it work though).

I'm still interested to here if anyone have a solution for my problem to
debug my com addin.

Regards
/Hans


 
Reply With Quote
 
John Covert
Guest
Posts: n/a
 
      19th Nov 2003
Hans & Company:

I've been working sixteen hour days for the past four days trying to get
this remedied and my diet from dinner to sleep has been coffee and nicotine
so kindly do not accept this as gospel, but here goes:

I believe I have this issue (debugging in VB) resolved.

What appears to have fixed it is downloading and installing Office 2000
Service Release 1a (SR-1a).

In my case, I could watch objOutlookApplication and "browse" the
ActiveExplorer.CommandBars property, but if I tried to watch
objOutlookApplication.ActiveExplorer.CommandBars, I'd get Interface not
Registered or Method 'item' of _commandbars failed....

This indicated that it was Office that was somehow corrupted, since in the
former case CommandBars was a member of an Outlook Object/Class whereas
objOutlookApplication.ActiveExplorer.CommandBars is an Office Object/Class.

I'm just a Business School graduate who decided to code one day so I know
not the internals but I figured corruption of Office DLLs ==or=== corruption
of Office 2000's registry entries was the culprit.

At any rate, installing SR-1a appears to have fixed it.

You can find it here:

http://www.microsoft.com/downloads/d...DisplayLang=en

Of course I cannot warranty this solution and I have not fully tested here
but Hans from your email I know you are "in a coma" with respect to getting
this done so i toss this "out there".

You will need your Office 2000 CDs.

Best of luck,

John


"Hans Börjesson" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi Ken!
>
> I have tested with this earlier (and I tried it now once again) and I get
> exception anyway "Method 'item' of _commandbars failed. If I debug the
> m_objExpl.CommandBars.Count it seems to show the right number of elements.
> If I did not call my function to delete my toolbar (which I actually think

I
> don't have to call since I use the temporary=true when I create the

toolbar)
> it fails when I try do add my commandbar with error Interface not
> registered.
>
> There must be something corrupt with my registry but I don't understan why
> it works when I run the dll and not when I run via VB.
>
> Set oCommandBar = m_objExpl.CommandBars.Add("VendimoToolbar", , , True)
> oCommandBar.Visible = True
> oCommandBar.Enabled = True
> oCommandBar.Position = msoBarTop
>
> Set oCmdExplorerBtn = oCommandBar.Controls.Add(msoControlButton, , , ,
> True)
> oCmdExplorerBtn.Caption = g_xml.WriteTextValue("msg_028")
> oCmdExplorerBtn.Enabled = True
> oCmdExplorerBtn.Visible = True
> oCmdExplorerBtn.Tag = GetNewGuid
> m_btoolbarsAdded = True
>
>
> Regards
> /Hans
>
>



 
Reply With Quote
 
Hans Börjesson
Guest
Posts: n/a
 
      19th Nov 2003
Hi!

Since I already had SR1 installed I did a repair on this and it looks like
it is working now so thanks Dave for the tip!

Regards
/Hans


 
Reply With Quote
 
Hans Börjesson
Guest
Posts: n/a
 
      19th Nov 2003
Sorry thanks John (not Dave)!

Have been working too many hours....

Regards
/Hans


 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      20th Nov 2003
Thanks for this John, and thanks for posting it here.

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


"John Covert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hans & Company:
>
> I've been working sixteen hour days for the past four days trying to

get
> this remedied and my diet from dinner to sleep has been coffee and

nicotine
> so kindly do not accept this as gospel, but here goes:
>
> I believe I have this issue (debugging in VB) resolved.
>
> What appears to have fixed it is downloading and installing Office

2000
> Service Release 1a (SR-1a).
>
> In my case, I could watch objOutlookApplication and "browse" the
> ActiveExplorer.CommandBars property, but if I tried to watch
> objOutlookApplication.ActiveExplorer.CommandBars, I'd get Interface

not
> Registered or Method 'item' of _commandbars failed....
>
> This indicated that it was Office that was somehow corrupted, since

in the
> former case CommandBars was a member of an Outlook Object/Class

whereas
> objOutlookApplication.ActiveExplorer.CommandBars is an Office

Object/Class.
>
> I'm just a Business School graduate who decided to code one day so I

know
> not the internals but I figured corruption of Office DLLs ==or===

corruption
> of Office 2000's registry entries was the culprit.
>
> At any rate, installing SR-1a appears to have fixed it.
>
> You can find it here:
>
>

http://www.microsoft.com/downloads/d...=af6c8d03-7633
-45b4-ab96-795ee656f2a2&DisplayLang=en
>
> Of course I cannot warranty this solution and I have not fully

tested here
> but Hans from your email I know you are "in a coma" with respect to

getting
> this done so i toss this "out there".
>
> You will need your Office 2000 CDs.
>
> Best of luck,
>
> John



 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug An Addin ME Microsoft C# .NET 0 26th Aug 2004 04:07 PM
Debug An Addin ME Microsoft VC .NET 0 26th Aug 2004 04:07 PM
My VB.NET Addin doesn't WORK/DEBUG/COMPILED Mat Microsoft Outlook Program Addins 0 20th Sep 2003 02:20 AM
How to debug a COM AddIn for Word written in VB.NET? Jaime Rios Microsoft Dot NET 0 4th Sep 2003 06:45 PM
Pleas How to Debug VB.NET addin with Outlook 2000? Ms.net Microsoft Dot NET 2 10th Jul 2003 07:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 PM.