ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel to word macro (https://www.excelbanter.com/excel-discussion-misc-queries/249884-excel-word-macro.html)

dwake

Excel to word macro
 
So I created a macro that opens a word file and pastes into excel. The
problem I'm having is closing the word document after it has been used. Here
is my code below. Any help would be appreciated.

Sub WordToExcel()
Dim MyWd As Object
Set MyWd = GetObject("Audit Tracking.doc")

MyWd.ActiveWindow.Selection.WholeStory
MyWd.ActiveWindow.Selection.Copy

Sheet8.Range("A1").PasteSpecial xlPasteValues
End Sub

Susan

Excel to word macro
 
don't multipost.
see the reply in your other thread.
susan


On Dec 2, 1:19*pm, dwake wrote:
So I created a macro that opens a word file and pastes into excel. *The
problem I'm having is closing the word document after it has been used. *Here
is my code below. *Any help would be appreciated.

Sub WordToExcel()
* Dim MyWd * * * As Object
* Set MyWd = GetObject("Audit Tracking.doc")

* MyWd.ActiveWindow.Selection.WholeStory
* MyWd.ActiveWindow.Selection.Copy

* Sheet8.Range("A1").PasteSpecial xlPasteValues
End Sub




All times are GMT +1. The time now is 07:19 AM.

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