Macro to open a word document from excel
Set oWordApp = CreateObject("Word.Application")
If Range("H1").Value = "Y" Then
Set oDoc = oWordApp.Documents.Open("C:\personal\bob\doc1.doc" )
Else
Set oDoc = oWordApp.Documents.Open("C:\personal\jim\another.d oc")
End If
'do something
Set oDoc = Nothing
oWordApp.Quit
Set oWordApp = Nothing
If your VBA is non-existent, what will you do with the doc when it is
opened?
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"MarkC" wrote in message
...
Hi, my VBA knowledge is non existent!! How do I do that ?
"Bob Phillips" wrote:
Just change the logic to do the test before the documents open in a
simple
If ... Else test.
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my
addy)
"MarkC" wrote in message
...
How does this work if there is a N in the column, as that will have to
open
the other word doc...sorry should have explained this more...Thanks for
the
reply.
"Bob Phillips" wrote:
If Range("H1").Value = "Y" Then
Set oWordApp = CreateObject("Word.Application")
Set oDoc = oWordApp.Documents.Open("C:\personal\bob\doc1.doc" )
'do something
Set oDoc = Nothing
oWordApp.Quit
Set oWordApp = Nothing
End If
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my
addy)
"MarkC" wrote in message
...
Can anyone help please,I am looking for a macro that will open a
word
template based upon a 'Y' or 'N' answer in an excel column (column
G).
Can this be done?
|