Discussion:
Problem with reference being replicated **Repost from Addins**
(too old to reply)
JB
2005-02-03 10:36:38 UTC
Permalink
**Orig post in addins but no help offered.**

Hi Folks,
I have a template set which I use to attatch addins to a new/existing
document. My users are spread all over the place and do not have the
same environment/shares so this means I have multiple "copies" of teh
addin stored on admin shares.

What I do at the moment is determine (via registry settings) what they
have mapped to my addin location and add a reference to the addin using

MyProject.ThisDocument.VBProject.References.AddFromFile
AddinLocationandName which works fine and every new document based on
the template has the addin available to them.

Problem is that these docuemnts may be passed around environments which
makes the reference no longer valid as it's not on the same share. I
have a utility that allows them to open the doc which removes attached
template and adds the new addin location using

ActiveDocument.AttachedTemplate = "" and

addNo = AddIns.Count
For i = addNo To 1 Step -1
temp = AddIns.Item(i)
If temp = AddinName Then
AddIns.Item(i).Delete
End If
Next i

addtemp:
With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = Template(0)
End With
AddIns.Add FileName:=Template(1), Install:=True

This kinda works but I find myself with 2 addins installed if I look in
Tools > Templates and Addins, and I think it's something to do with not
removing the previous reference which I can't seem to do.

Any pointers???

Cheers

J
Tom Winter
2005-02-03 14:54:25 UTC
Permalink
Gee, i should have looked up one message before replying to your other one!
--
Tom Winter
Post by JB
**Orig post in addins but no help offered.**
Hi Folks,
I have a template set which I use to attatch addins to a new/existing
document. My users are spread all over the place and do not have the same
environment/shares so this means I have multiple "copies" of teh addin
stored on admin shares.
What I do at the moment is determine (via registry settings) what they
have mapped to my addin location and add a reference to the addin using
MyProject.ThisDocument.VBProject.References.AddFromFile
AddinLocationandName which works fine and every new document based on the
template has the addin available to them.
Problem is that these docuemnts may be passed around environments which
makes the reference no longer valid as it's not on the same share. I have
a utility that allows them to open the doc which removes attached template
and adds the new addin location using
ActiveDocument.AttachedTemplate = "" and
addNo = AddIns.Count
For i = addNo To 1 Step -1
temp = AddIns.Item(i)
If temp = AddinName Then
AddIns.Item(i).Delete
End If
Next i
With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = Template(0)
End With
AddIns.Add FileName:=Template(1), Install:=True
This kinda works but I find myself with 2 addins installed if I look in
Tools > Templates and Addins, and I think it's something to do with not
removing the previous reference which I can't seem to do.
Any pointers???
Cheers
J
Loading...