Using Macro to Close Word File

  • Thread starter Thread starter dwake
  • Start date Start date
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
 
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
 
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
 
Back
Top