Hi Folks,
I'm having trouble with a Template which sets a reference to an addin using
MyTemplate.ThisDocument.VBProject.References.AddFromFile strRef.

If the document needs to move to another environment which has a different
setup to the originating env it can use a Wizard, which opens the document,
adds the addin appropriate to that env using "AddIns.Add
FileName:=strTemplate(1), Install:=True".
But something somewhere goes wrong and when i check my references it says
Missing and points to a temp file : C:\Documents and Settings\User\Local
Settings\Temp\3\WRL????.???

**This is in the wizard to open the doc**

Set MyDialog = Dialogs(wdDialogFileOpen)
MyDialog.Format = wdFormatDocument

If MyDialog.Display <> -1 Then GoTo ErrOpen
MyDialog.Execute
ActiveDocument.AttachedTemplate = ""
End If

Can anyone help me with this?

Cheers

J

Re: Problems With Reference to Addin by Perry

Perry
Sun Nov 14 18:29:42 CST 2004

Have you tried to compile your project?

Before twisting yr mind about what is happening to the reference y're
trying to set, below lines are not compilable...

> If MyDialog.Display <> -1 Then GoTo ErrOpen
> MyDialog.Execute
> ActiveDocument.AttachedTemplate = ""
> End If

The If Then block is not valid in above sequence.

Krgrds,
Perry

<me@me.com> schreef in bericht news:oZKdnfeoya8weAncRVnyjQ@giganews.com...
> Hi Folks,
> I'm having trouble with a Template which sets a reference to an addin
using
> MyTemplate.ThisDocument.VBProject.References.AddFromFile strRef.
>
> If the document needs to move to another environment which has a different
> setup to the originating env it can use a Wizard, which opens the
document,
> adds the addin appropriate to that env using "AddIns.Add
> FileName:=strTemplate(1), Install:=True".
> But something somewhere goes wrong and when i check my references it says
> Missing and points to a temp file : C:\Documents and Settings\User\Local
> Settings\Temp\3\WRL????.???
>
> **This is in the wizard to open the doc**
>
> Set MyDialog = Dialogs(wdDialogFileOpen)
> MyDialog.Format = wdFormatDocument
>
> If MyDialog.Display <> -1 Then GoTo ErrOpen
> MyDialog.Execute
> ActiveDocument.AttachedTemplate = ""
> End If
>
> Can anyone help me with this?
>
> Cheers
>
> J



Re: Problems With Reference to Addin by me

me
Mon Nov 15 07:33:17 CST 2004

Hi Perry,
My mistake...there should be no end if at the end of that statement and the
code I have does compile fine. I have no idea why the temp file is being
used rather than the absolute reference I put in.

If the reference already exists and I tried to add a reference with On Error
Resume Next would it remove the existing reference or cause problems I am
seeing here??

Cheers

J