title: How to paste data to word doc
body: <p>I am using send-keys to select all data and copy it from another application. My goal is to paste this data into word and save as a PDF. The problem i seem to have, is that using Microsoft interop, requires you to programattically format the data. If i copy the data from the other application, and paste it manually in a real word doc, the format retains itself.</p>
  
  <p>Is there a way to easily take my clipboard data and use it with this code?</p>
  
  <pre><code>Try
              Dim oWord As Word.Application
              Dim oDoc As Word.Document
  
  
  
              'Start Word and open the document template.
              oWord = CreateObject("Word.Application")
              oWord.Visible = True
              oDoc = oWord.Documents.Add
              oPara1 = oDoc.Content.Paragraphs.Add
              oPara1.Range.Text = Clipboard.SetText
  
              'TIll Above your entire odoc is formatted
              'From below I will save it to my own code
  
              Dim newdoc As Word.Document
              newdoc = oDoc
              newdoc.SaveAs2("K:\file.pdf", Word.WdSaveFormat.wdFormatPDF)
  
              'All done. Close this form.
              'BSPGlobals.DataBase.Contact.ExitApp()
              MessageBox.Show("Print to Doc Done.")
          Catch ex As Exception
              MessageBox.Show("Error at Printing the bill." &amp; vbCrLf &amp; ex.Message)
          End Try
  </code></pre>