Discussion
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.
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.
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
'*****************************************************
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
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


