Insert hyperlink to .dot file to create a new document

  • Thread starter Thread starter pysse
  • Start date Start date
P

pysse

Good morning,
I'm trying to insert a hyperlink to a .dot file - and
that works fine, except that I want to create a new word
doc - not open the .dot file.
What am I doine wrong
Kind Regards
Pysse
 
Maybe you could put a button from the forms toolbar on the worksheet and assign
it a macro to open a new word document based on your template:

Option Explicit
Sub testme01()

Dim oWord As Object
Dim myWordTemplate As String
Dim testStr As String

myWordTemplate = "c:\msoffice\templates\1033\Elegant Fax.dot"

testStr = ""
On Error Resume Next
testStr = Dir(myWordTemplate)
On Error GoTo 0
If testStr = "" Then
MsgBox myWordTemplate & " doesn't exist"
Exit Sub
End If

On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err Then
Set oWord = CreateObject("Word.Application")
End If

oWord.Visible = True
oWord.Documents.Add Template:=myWordTemplate

End Sub
 
Back
Top