title: Saving a text file from a PDF in Notepad using VBA without SendKeys
body: <p>So, what I am trying to do is take a pdf file, open it with internet explorer, copy the text from it, paste that text to a text file in Notepad and save that file with the same name as the pdf that it was created from. I have accomplished all of this so far with the exception of saving the text file once I have the data I need in it. I've found myself now stuck, any ideas would be helpful.</p>
  
  <p>Here is the code that I have so far:</p>
  
  <pre><code>Set b2 = ThisWorkbook
  
  Set ie = CreateObject("InternetExplorer.Application")
  strPath = "C:\Users\353281\Desktop\test 134.pdf"
  
  ie.Visible = True
  ie.navigate (strPath)
  
  Do While ie.Busy And ie.ReadyState &lt;&gt; 4
          DoEvents
      Loop
  
  
  Application.Wait Now + TimeSerial(0, 0, 2)
      AppActivate strPath
      SendKeys "^(a)", True
      Application.Wait Now + TimeSerial(0, 0, 1)
  
      Do
          On Error Resume Next
          SendKeys "^(c)", True
      Loop While Err.Number &lt;&gt; 0
  np = Shell("Notepad.exe", vbNormalFocus)
  
  
  AppActivate np
  SendKeys "^(v)", True
  'tried the SendKeys method of saving my text file here, not to much avail
  SendKeys "^(s)", True
  
  'this bit here finds the file name of strPath
  a = InStrRev(strPath, "\")
  b = InStrRev(strPath, ".")
  c = Mid(strPath, a + 1, b - a - 1)
  
  'haven't got anything after this point but a few failed attempts
  </code></pre>
  
  <p>(I apologize for the code being messy, I don't focus on structure until I have something together that works)</p>