JadeKnight
IS-IT--Management
Hi, I've got a problem with a couple of macros. Our company has just changed from Office97 to Office 2003, and our old templates/macroes are obsolete.
I have corrected most of it, but I do have a little problem. I have one template, let's call it X wich is using code from a "master" template. Let's call it common. This is working fine until we close the document. If we try to create a new, we recieve an error that says that the macro doesn't exist. The common template is still open. However, if we close Word, and start with a new document, this works fine.
I'm pretty familiar with VBscript, but this isn't my domain. I assume that there is a way to close the open common template. Any help would be appreciated
...
Here's the code :
Constants defined in Modules :
Public Const coMainDotFile As String = "Common.dot"
Public Const coMainDotFileNamePath As String = "C:\temp\Common.dot"
ThisDocument
I have corrected most of it, but I do have a little problem. I have one template, let's call it X wich is using code from a "master" template. Let's call it common. This is working fine until we close the document. If we try to create a new, we recieve an error that says that the macro doesn't exist. The common template is still open. However, if we close Word, and start with a new document, this works fine.
I'm pretty familiar with VBscript, but this isn't my domain. I assume that there is a way to close the open common template. Any help would be appreciated
Here's the code :
Constants defined in Modules :
Public Const coMainDotFile As String = "Common.dot"
Public Const coMainDotFileNamePath As String = "C:\temp\Common.dot"
ThisDocument
Code:
Option Explicit
Private Sub Document_Close()
Call byttTilGammelSkriver(ActiveDocument.AttachedTemplate)
End Sub
Private Sub Document_New()
On Error GoTo err_trap
Dim lTeller As Long
Dim bFunnet As Boolean
bFunnet = False
For lTeller = 1 To AddIns.Count
If AddIns.Item(lTeller).Name = coMainDotFile Then
bFunnet = True
Exit For
End If
Next lTeller
If Not bFunnet Then
Call AddIns.Add(coMainDotFileNamePath, True)
lTeller = AddIns.Count
Else
AddIns(lTeller).Installed = True
End If
Call AddIns(lTeller).Application.Activate
frmFillIn.Show
Call byttSkriver(ActiveDocument.AttachedTemplate)
Exit Sub
err_trap:
Resume Next
End Sub