title: close word with microsoft visual basic 6.5 macro
body: <p>Platform : Microsoft Visual Basic 6.5 and MS words 2007</p>
  
  <p>I am trying to do a macro to do some editing to an words enable file. Done research on how to close the Excel file without saving, which Santosh had successfully help me solve the problem <a href="https://stackoverflow.com/questions/15779333/compile-error-while-declaring-close">Solution</a>.Tried applying to words There is no error while compling and saving</p>
  
  <p>Placed the following coding in TheDocument similar to where Santosh had teached me for excel.</p>
  
  <p>Private Sub Workbook_BeforeClose(Cancel As Boolean)</p>
  
  <pre><code>Me.Close False
  </code></pre>
  
  <p>End Sub</p>
  
  <p>tried to replaced Me.Close False with the following coding...</p>
  
  <p>1) Me.close</p>
  
  <p>2) Me.close(false)</p>
  
  <p>3) ActiveDocument.Close</p>
  
  <p>4) ActiveDocument.Close (false)</p>
  
  <p>5) ActiveDocument.Quit</p>
  
  <p>6) Application.Quit (False)</p>
  
  <p>7) Application.Close</p>
  
  <p>But doesn't work.</p>
  
  <hr>
  
  <p>Because I would be using a vba script to run a script to Update my words documents and to print accordingly to my value input. After that the script will close this documents without saving(I don't it to prompt user that there is changes and prompt user to save). I want it to so call "force close" without any prompting. 
  For ms excel 2007... I access the Developer tools to go to MS Visual Basic 6.5
  under the "ThisWorkbook"... i enter the following command..</p>
  
  <p>Private Sub Workbook_BeforeClose(Cancel As Boolean)</p>
  
  <pre><code>Me.Close False
  </code></pre>
  
  <p>End Sub</p>
  
  <p>this command successfully close the excel without saving or any prompt (which is what i want)
  tried to apply it to words2007</p>
  
  <p>Private Sub Document_Close()
      'Me.Close 'run-time error '4198'</p>
  
  <pre><code>'Me.Close (SaveChanges:=wdDoNotSaveChanges,OriginalFormat:=wdOriginalDocumentFormat,RouteDocument:=True)
  
  'Me.Quit Savechanges:=wdDoNotSaveChanges
  
  'Me.Close Savechanges:=wdDoNotSaveChanges
  
  'Me.Close False 'run-time error '4198'
  
  'ActiveDocument.Close False 'run-time error '4198'
  
  'Document.Close False 'run time error '424' Object required
  
  'Document.Close Savechanges:=wdDoNotSaveChanges  'run time error '424' Object required
  
  
  'Document.Close Savechanges 'run time error '424' Object required
  
  
  'Me.Close Savechanges 'run-time error '4198'  
  
  
  
  'Documents.Close SaveChanges:=wdDoNotSaveChanges
  </code></pre>
  
  <p>End Sub</p>
  
  <p>'Sub CloseAllDocuments()
  '    Documents.Close SaveChanges:=wdDoNotSaveChanges
  'End Sub</p>
  
  <p>all these commands i commented out all ended with errors</p>