Problem to attache template

C

camilla

Hi

Can anyone help me why the template "Adressmall_DNV_Sweden.dot" dont be
correctly attached.
Teh msgbox is only to help me deug the code and when i step through the code
will not Adressmall_DNV_Sweden.dot came up in the msgbox.
Exactly the same code works fine in another template

Public Sub Main()


On Error Resume Next
Set vbProj = ActiveDocument.VBProject
vbProj.References.AddFromFile "C:\Mallar\Adressmall_DNV_Sweden.dot"
For x = 1 To Word.Templates.Count
If Templates(x).Name = "Adressmall_DNV_Sweden.dot" Then
num = x
Exit For
End If


MsgBox (Templates(x).Name)
Next x


frmMain.Show
End Sub
 
W

Word Heretic

G'day "camilla" <[email protected]>,

test the right part of the string with right$ to a length of
len(yourtemplatename)



camilla said:
Hi

Can anyone help me why the template "Adressmall_DNV_Sweden.dot" dont be
correctly attached.
Teh msgbox is only to help me deug the code and when i step through the code
will not Adressmall_DNV_Sweden.dot came up in the msgbox.
Exactly the same code works fine in another template

Public Sub Main()


On Error Resume Next
Set vbProj = ActiveDocument.VBProject
vbProj.References.AddFromFile "C:\Mallar\Adressmall_DNV_Sweden.dot"
For x = 1 To Word.Templates.Count
If Templates(x).Name = "Adressmall_DNV_Sweden.dot" Then
num = x
Exit For
End If


MsgBox (Templates(x).Name)
Next x


frmMain.Show
End Sub

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 

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