Can anyone help please, I have the macro below which selects 1 of 2 forms
based on critera in an excel spreadsheet cell. What is not happeneing , is
that a normal word doc should open from the word template its based on. But
the macro below opens the .dot template....not creating a doc from the
template.
can anyone help please!.
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\Template\ST011AFO
Issue 1 Advice note AND Customs invoice.dot"
Else
sFilename = "M:\001_Quality\Manual advice Notes\Template\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
Helmut Weber - 07 Jun 2007 12:03 GMT
Hi Mark,
apart from other issues,
it is
documents.add
not
documents.open

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Pranav Vaidya - 12 Jun 2007 17:17 GMT
Try using the Documents.add method.
Also please check where is the template code, it should be in New method
With add method above, the code in New will automatically get executed.
Regards.
> Can anyone help please, I have the macro below which selects 1 of 2 forms
> based on critera in an excel spreadsheet cell. What is not happeneing , is
[quoted text clipped - 26 lines]
>
> End Sub