Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Using Macro to Close Word File

I need to use an excel macro to close a word file....any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Using Macro to Close Word File

Try the below. Make sure the name of word document is typed correctly....

Sub ControlWord()
Dim appWord As Object
Set appWord = GetObject(, "Word.Application")
appWord.Documents("Content Management.doc").Close False
End Sub

--
Jacob


"dwake" wrote:

I need to use an excel macro to close a word file....any suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Using Macro to Close Word File

Tried that and it didnt work. 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


"Jacob Skaria" wrote:

Try the below. Make sure the name of word document is typed correctly....

Sub ControlWord()
Dim appWord As Object
Set appWord = GetObject(, "Word.Application")
appWord.Documents("Content Management.doc").Close False
End Sub

--
Jacob


"dwake" wrote:

I need to use an excel macro to close a word file....any suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Using Macro to Close Word File

Try

Sub ControlWord()
Dim appWord As Object
Set appWord = GetObject(, "Word.Application")
appWord.Documents("Audit Tracking.doc").ActiveWindow.Selection.Copy
Range("A1").PasteSpecial xlPasteValues
appWord.Documents("Audit Tracking.doc").Close False
End Sub

--
Jacob


"dwake" wrote:

Tried that and it didnt work. 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


"Jacob Skaria" wrote:

Try the below. Make sure the name of word document is typed correctly....

Sub ControlWord()
Dim appWord As Object
Set appWord = GetObject(, "Word.Application")
appWord.Documents("Content Management.doc").Close False
End Sub

--
Jacob


"dwake" wrote:

I need to use an excel macro to close a word file....any suggestions?

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
Macro to save and close, then copy file NewSysAdmin Excel Discussion (Misc queries) 2 December 2nd 09 03:24 PM
How to close a excel file using Macro coding? Eric Excel Worksheet Functions 5 June 11th 07 03:02 PM
How to close a excel file using Macro coding? Eric Excel Discussion (Misc queries) 1 June 11th 07 08:49 AM
How to code the Macro to save and close a file? Eric Excel Discussion (Misc queries) 7 June 10th 07 03:28 PM
Macro to Open, then Close another File HROBERTSON Excel Discussion (Misc queries) 1 January 8th 07 06:41 PM


All times are GMT +1. The time now is 12:27 PM.

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

About Us

"It's about Microsoft Excel"