Office2000
Author
Discussion

atomicrex

Original Poster:

862 posts

257 months

Tuesday 11th April 2006
quotequote all
I have written a VB Addin for Word. The addin builds a toolbar on connection, but I need one of the buttons to be controlled by the events of the application ie open or new document.

Now the obvious option would be to create an object "WithEvents" equal to the application in the open connection routine?

And this works fine in Office XP and Office 2003, but Office 2000 causes Word to hang.

Can anyone offer any thoughts?
My other option is to add the same code into the Normal Template, but I want to try and keep the code in the same place.

atomicrex

Original Poster:

862 posts

257 months

Tuesday 11th April 2006
quotequote all
Surely someone has an idea?

aldi

9,288 posts

267 months

Tuesday 11th April 2006
quotequote all
Shouldnt just hang whatver the problem is surely... There's a few service packs out for O2k too might be worth a shot :confised: Its deff. just hanging on the 'WithEvents' when you step into it?

atomicrex

Original Poster:

862 posts

257 months

Wednesday 12th April 2006
quotequote all
I will try the service packs, but this is the start of the code

'*****************************************************
Option Explicit

Dim obar As Office.CommandBar
Dim WithEvents oButAdminAdds As Office.CommandBarButton
Dim WithEvents oButAdminControl As Office.CommandBarButton
Dim WithEvents oButNewTem As Office.CommandBarButton
Dim WithEvents oButEditTem As Office.CommandBarButton

Dim WithEvents oApp As Word.Application

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)
On Error Resume Next

Set oApp = Application
Set gm_oWApp = Application
Set gm_oNorm = gm_oWApp.NormalTemplate
'*****************************************************

On setting oApp even stepping through the code, it just hangs. Task manager states that Word isnt responding. Yet the same code run against xp or 2003 runs straight through

Downloading the latest service pack now