C
Co
Hi All,
I want to get the text from the first paragprahs of a word document
and copy it to the clipboard.
But my code stops when it should copy to the clipboard.
Function ReadWordDocument(ByVal sPathName As String, ByVal sDocName
As String) As String
Dim wdToepassing As New Word.Application
Dim wdDoc As Word.Document
Dim parra As Word.Paragraph
wdDoc = wdToepassing.Documents.Open(sPathName & sDocName)
With wdDoc
parra = .Paragraphs(1)
parra.Range.Select()
.Selection.Copy() --> code stops, no error message!!
End With
ReadWordDocument = _
System.Windows.Forms.Clipboard.GetDataObject.GetData
(DataFormats.Text)
wdDoc = Nothing
wdToepassing.ActiveWindow.Close()
wdToepassing = Nothing
End Function
Marco
I want to get the text from the first paragprahs of a word document
and copy it to the clipboard.
But my code stops when it should copy to the clipboard.
Function ReadWordDocument(ByVal sPathName As String, ByVal sDocName
As String) As String
Dim wdToepassing As New Word.Application
Dim wdDoc As Word.Document
Dim parra As Word.Paragraph
wdDoc = wdToepassing.Documents.Open(sPathName & sDocName)
With wdDoc
parra = .Paragraphs(1)
parra.Range.Select()
.Selection.Copy() --> code stops, no error message!!
End With
ReadWordDocument = _
System.Windows.Forms.Clipboard.GetDataObject.GetData
(DataFormats.Text)
wdDoc = Nothing
wdToepassing.ActiveWindow.Close()
wdToepassing = Nothing
End Function
Marco