I am quite new to vba programming, but desided that trying is the best way to learn, turns out to our project got more complicated than expecten and because of that I have the following problem
We are having a .dot file which is to open other templates. This is the code that we are using to open the other templates:
Sub letterofcomplaint()
'
' Letterofcomplaint Makro
' Makro indspillet 16-03-2004 af Lars Gravesen
'
Documents.Add Template:= _
"C:\letter_transplate\Breve\letter_complaint.d ot" _
, NewTemplate:=False, DocumentType:=0
End Sub
As you can see we are using a full path for the templates (c:\letter.........). The reason that we are using the full path is that we are having problems when using the relative path for opening the templates. Here is what happens.
When we use the relative path we can open the templates and this works fine BUT. But when we opens a template and then inserts some sentences through a macro integrated in the templates the problems comes. Beneath is the code for inserting text
Sub Jegskriverforatklage()
'
Selection.TypeText Text:= _
"I am writing to complain about the late delivery of our order we/345. "
Selection.Comments.Add Range:=Selection.Range
Selection.TypeText Text:="Jeg skriver for at klage over den sene levering af vores ordre we/345."
ActiveWindow.ActivePane.
End sub
When we have inserted a sentence or used a macro in the template and use our original template and wants to opens other templates the path does not work any more it is like the apth is broken and the template can't find the other templates.
The relative path that we are using to open the other templates are the following.
Sub Hovedbrev()
'
Documents.Add Template:= _
".\start.dot" _
, NewTemplate:=False, DocumentType:=0
End Sub
Can anyone give us any ideas for what we are doing wrong and perhaps how to solve this problem.
The reason that we want the relative path to the other templates are that all templates are placed on a cd rom and therefore we don't know what drive letter their computer are using.
Hope that you can understand our little problem and any help are more than welcome. :-)
Thanks
mlm