Can anyone help please, I have an excel spreadheet that when a cell is
controlled by a Y or N answer only, it selects a word document to complete.
This form shoudl be created from a template in the normal way word does, but
my macro is simply opening the template (.dot file openining, not a .doc
file), not creating from the template. Can anyone help as to how I can
achive this by modifying the VBA below.
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
thank you
Jean-Guy Marcil - 07 Jun 2007 15:09 GMT
MarkC was telling us:
MarkC nous racontait que :
> Can anyone help please, I have an excel spreadheet that when a cell is
> controlled by a Y or N answer only, it selects a word document to
[quoted text clipped - 27 lines]
>
> thank you
Change
Set oDoc = oWordApp.Documents.Open(sFilename)
to
Set oDoc = oWordApp.Documents.Add(sFilename)

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org