open doc file from dot file by use of macro selectiom

M

MarkC

Can anyone help please, i have the macro below in a workbook. What I would
like is it to open a word doc from the dot template, as word does.The problem
is the macro opens the .dot file, not a .doc from the .dot(template).

Can anyone help, thank you

Sub GetWordDocument()
Dim oWordApp As Object
Dim oDoc As Object
Dim sFilename As String

Set oWordApp = CreateObject("Word.Application")
If Range("G3").Value = "Y" Then
sFilename = "M:\001_Quality\Manual advice Notes\ST011AFO Issue 1 Advice note
AND Customs invoice.dot"
Else
sFilename = "M:\001_Quality\Manual advice Notes\ST011FO Issue 4 Manual
Advice Note.dot"
End If
Set oDoc = oWordApp.Documents.Open(sFilename)
oWordApp.Visible = True
Set oDoc = Nothing
Set oWordApp = Nothing
End Sub


Private Sub CommandButton1_Click()

End Sub
 

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