Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to open a word document from excel

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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro to open a word document from excel

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?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to open a word document from excel

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?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro to open a word document from excel

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?







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to open a word document from excel

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?










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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?










  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to open a word document from excel

The actual spreadsheet is an advice note register for deliveries, depending
on if they select Y or N, the marco will open the correct form to fill in as
we have incendences of people completing/saving the incorrect form. This just
makes the decison for them.


thank you for your help.
"Bob Phillips" wrote:

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?











  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to open a word document from excel

Hiya, I am getting a compile error 'INVALID OUTSIDE PROCEDURE',
I have changed the range to read G3 as this is is the cell that it will
read the y/n from (When we add a new entry it moves a row down (so row 3 is
always for 'new data'

Can you tell me whee I'm going wrong, thank you

Set oWordApp = CreateObject("Word.Application")
If Range("G3").Value = "Y" Then
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011AFO Issue 1 Advice
note AND Customs invoice.dot")
Else
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011FO Issue 4 Manual
Advice Note.dot")
End If
'do something
Set oDoc = Nothing
oWordApp.Quit
Set oWordApp = Nothing



"Bob Phillips" wrote:

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?











  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro to open a word document from excel

First, you need to put it in a sub.

Second, as they are forms to fill-in, you need to make Word visible, and not
quit after opening the docs.

Try

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 = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\ST011AFO Issue 1 Advice " &
_
"note AND Customs invoice.dot"
Else
sFilename = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\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




--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MarkC" wrote in message
...
Hiya, I am getting a compile error 'INVALID OUTSIDE PROCEDURE',
I have changed the range to read G3 as this is is the cell that it will
read the y/n from (When we add a new entry it moves a row down (so row 3
is
always for 'new data'

Can you tell me whee I'm going wrong, thank you

Set oWordApp = CreateObject("Word.Application")
If Range("G3").Value = "Y" Then
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011AFO Issue 1 Advice
note AND Customs invoice.dot")
Else
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011FO Issue 4 Manual
Advice Note.dot")
End If
'do something
Set oDoc = Nothing
oWordApp.Quit
Set oWordApp = Nothing



"Bob Phillips" wrote:

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?













  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to open a word document from excel

Thank you, 1 more question!! (sorry for this, but your help is really
appreciated) If I run the macro from the code view it works, but nothing
happens from the normal spreadsheet view when you insert a Y OR N in cell
G3?? Any suggestions, I tried to put a button on the spreadsheet to create
the form linking it to the vba you have supplied me, but that just says
compile error.

Thank you again,
Mark

"Bob Phillips" wrote:

First, you need to put it in a sub.

Second, as they are forms to fill-in, you need to make Word visible, and not
quit after opening the docs.

Try

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 = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\ST011AFO Issue 1 Advice " &
_
"note AND Customs invoice.dot"
Else
sFilename = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\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




--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MarkC" wrote in message
...
Hiya, I am getting a compile error 'INVALID OUTSIDE PROCEDURE',
I have changed the range to read G3 as this is is the cell that it will
read the y/n from (When we add a new entry it moves a row down (so row 3
is
always for 'new data'

Can you tell me whee I'm going wrong, thank you

Set oWordApp = CreateObject("Word.Application")
If Range("G3").Value = "Y" Then
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011AFO Issue 1 Advice
note AND Customs invoice.dot")
Else
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011FO Issue 4 Manual
Advice Note.dot")
End If
'do something
Set oDoc = Nothing
oWordApp.Quit
Set oWordApp = Nothing



"Bob Phillips" wrote:

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?
















  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro to open a word document from excel

Add this extra code

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "G3" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Call GetWordDocument
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MarkC" wrote in message
...
Thank you, 1 more question!! (sorry for this, but your help is really
appreciated) If I run the macro from the code view it works, but nothing
happens from the normal spreadsheet view when you insert a Y OR N in cell
G3?? Any suggestions, I tried to put a button on the spreadsheet to
create
the form linking it to the vba you have supplied me, but that just says
compile error.

Thank you again,
Mark

"Bob Phillips" wrote:

First, you need to put it in a sub.

Second, as they are forms to fill-in, you need to make Word visible, and
not
quit after opening the docs.

Try

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 = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\ST011AFO Issue 1 Advice
" &
_
"note AND Customs invoice.dot"
Else
sFilename = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\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




--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"MarkC" wrote in message
...
Hiya, I am getting a compile error 'INVALID OUTSIDE PROCEDURE',
I have changed the range to read G3 as this is is the cell that it will
read the y/n from (When we add a new entry it moves a row down (so row
3
is
always for 'new data'

Can you tell me whee I'm going wrong, thank you

Set oWordApp = CreateObject("Word.Application")
If Range("G3").Value = "Y" Then
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011AFO Issue 1
Advice
note AND Customs invoice.dot")
Else
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011FO Issue 4
Manual
Advice Note.dot")
End If
'do something
Set oDoc = Nothing
oWordApp.Quit
Set oWordApp = Nothing



"Bob Phillips" wrote:

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?
















  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Macro to open a word document from excel

WORKS PERFECT - Thank you very much

"MarkC" wrote:

Thank you, 1 more question!! (sorry for this, but your help is really
appreciated) If I run the macro from the code view it works, but nothing
happens from the normal spreadsheet view when you insert a Y OR N in cell
G3?? Any suggestions, I tried to put a button on the spreadsheet to create
the form linking it to the vba you have supplied me, but that just says
compile error.

Thank you again,
Mark

"Bob Phillips" wrote:

First, you need to put it in a sub.

Second, as they are forms to fill-in, you need to make Word visible, and not
quit after opening the docs.

Try

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 = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\ST011AFO Issue 1 Advice " &
_
"note AND Customs invoice.dot"
Else
sFilename = "C:\Documents and Settings\mchallacombe\Desktop\" & _
"CRF_016\advice note\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




--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"MarkC" wrote in message
...
Hiya, I am getting a compile error 'INVALID OUTSIDE PROCEDURE',
I have changed the range to read G3 as this is is the cell that it will
read the y/n from (When we add a new entry it moves a row down (so row 3
is
always for 'new data'

Can you tell me whee I'm going wrong, thank you

Set oWordApp = CreateObject("Word.Application")
If Range("G3").Value = "Y" Then
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011AFO Issue 1 Advice
note AND Customs invoice.dot")
Else
Set oDoc = oWordApp.Documents.Open("C:\Documents and
Settings\mchallacombe\Desktop\CRF_016\advice note\ST011FO Issue 4 Manual
Advice Note.dot")
End If
'do something
Set oDoc = Nothing
oWordApp.Quit
Set oWordApp = Nothing



"Bob Phillips" wrote:

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?














Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel trying to open word document tina Excel Discussion (Misc queries) 2 April 19th 07 02:16 PM
what happens if I open an excel document in word? Emily Excel Discussion (Misc queries) 3 April 2nd 05 10:49 AM
Open a specific Word document from an Excel Macro Canoeist Excel Programming 3 March 22nd 05 06:35 AM
macro and button to open a word document from within excel JAJOSEPHESQ Excel Programming 1 May 5th 04 06:06 AM
open a word document in excel Herb[_4_] Excel Programming 1 August 9th 03 01:36 AM


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"