ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I open a named Word doc from an Excel macro (https://www.excelbanter.com/excel-programming/274629-how-can-i-open-named-word-doc-excel-macro.html)

Graham Davies

How can I open a named Word doc from an Excel macro
 
I can start Word by using Application.activatemicrosoftapp
xlmicrosoftword but this alsways opens a blank document. I
need to open an existing document to add something to it.


Any ideas??

Ed[_9_]

How can I open a named Word doc from an Excel macro
 
This is what I use:

Dim Word As New Word.Application
Dim WordDoc As New Word.Document
Dim Doc As String

Doc = "C:\insert file path and doc name here.doc"
Set WordDoc = Word.Documents.Open(Doc)
Word.Selection.WholeStory
Word.Selection.Copy

HTH
Ed

"Graham Davies" wrote in message
...
I can start Word by using Application.activatemicrosoftapp
xlmicrosoftword but this alsways opens a blank document. I
need to open an existing document to add something to it.


Any ideas??




Bob Phillips[_5_]

How can I open a named Word doc from an Excel macro
 
Graham,

Here's an example

Dim wordApp As Object

Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open Filename:="d:\Bob\My Documents\Excel.doc"
wordApp.Visible = True


--

HTH

Bob Phillips

"Graham Davies" wrote in message
...
I can start Word by using Application.activatemicrosoftapp
xlmicrosoftword but this alsways opens a blank document. I
need to open an existing document to add something to it.


Any ideas??





All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com