G
GrodanBoll
Hi
I'm trying to reference in a .dot template file with code ('code.dot') into another template file ('test01.dot').
I use this code (both files are in the same directory):
test01.dot
code.dot
When I use the test01 template i get this error:
Compile error:
Sub or Function not defined
Do I have to activate the reference code in some way?
When I reference the code via Tools -> Reference it works fine.
I have also tried to use the absolute file path in the reference code, but it still dont work.
What have I done wrong?
Ps
I have tried to repy with this question in a previous thread but it didn't work, so I'm sorry to have to create a new one. :/
Ds
I'm trying to reference in a .dot template file with code ('code.dot') into another template file ('test01.dot').
I use this code (both files are in the same directory):
test01.dot
Code:
Private Sub Document_New()
Dim msgBoxen As Variant
ThisDocument.VBProject.References.AddFromFile Templates(1).Path & "\code.dot" 'referencing the code file
msgBoxen = MsgBox(Templates(1).Path & "\code.dot is the path", vbCritical) 'Debug code to show the path
Test 'Trying to call a sub from the reference file
End Sub
code.dot
Code:
Public Sub Test()
Dim msgBoxen As Variant
msgBoxen = msgBox("Hello", vbCritical)
End Sub
When I use the test01 template i get this error:
Compile error:
Sub or Function not defined
Do I have to activate the reference code in some way?
When I reference the code via Tools -> Reference it works fine.
I have also tried to use the absolute file path in the reference code, but it still dont work.
What have I done wrong?
Ps
I have tried to repy with this question in a previous thread but it didn't work, so I'm sorry to have to create a new one. :/
Ds