Problems With Reference to Addin

M

me

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
 
P

Perry

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
 
M

me

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top