title: I want a powerpoint slide to automatically open a word document in another window
body: <p>I have a powerpoint slide show with lyrics to songs that I display on a projector. I also have a folder with Word documents that contain the lyrics and chords to the songs that a musician needs to perform the songs. I'd like to be able to open the slide show, run it in presenter mode(have the option to select slides from the list) and when I select a slide to display on the projector, I'd like for the corresponding Word document to open on another screen. My setup is laptop display for presenter mode, projector for lyrics for the congregation and monitor for displaying the Word document containing lyrics with chords. I'd like for the vba to close any open Word document without closing Word(so it will stay where I placed it on the display) and open the word document corresponding to the slide.</p>
  
  <p>It was finding word open, but I couldn't see any word visible. When I went to task Manager, there were 12 winword.exe's running. I killed them all and then modified the code and it started doing what I wanted it to do.</p>
  
  <pre><code>Public Sub OnSlideShowPageChange()
  On Error Resume Next
  Dim i As Integer
  i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
  If IsNull(Application.Presentations(1).Slides(i).Shapes.Range(Array("WordLoc")).TextFrame.TextRange.Text) Then
  Exit Sub
  End If
  Dim wdApp As Word.Application, wdDoc As Word.Document
  Set wdApp = GetObject(, "Word.Application")
  On Error GoTo 0
  If Not wdApp Is Nothing Then
  wdApp.Documents.Close (wdDoNotSaveChanges)
  On Error GoTo 0
  Else
  Set wdApp = CreateObject("Word.Application")
  End If
  Set wdDoc = wdApp.Documents.Open(Application.Presentations(1).Slides(i).Shapes.Range(Array("WordLoc")).TextFrame.TextRange.Text, , True)
  On Error GoTo 0
  wdApp.Visible = True
  wdDoc.Activate
  End Sub
  </code></pre>