how to copy date from doc files
i have this coding for reading data from word file( i have to read atleast 1000 doc files).i put a while loop for reading all these files.
but i have a problem is that when i open another word file it disturbs the already open file. through loop.
i want a solution which reads all the files and whenever somebody open any other word file it opens in new word document.
Dim File As Object = FileName
Dim NullObj As Object = System.Reflection.Missing.Value
Dim Doc As Word.Document = WordApp.Documents.Open(File, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj, NullObj)
Try
Doc.ActiveWindow.Selection.WholeStory()
Doc.ActiveWindow.Selection.Copy()
Dim Data As IDataObject = Clipboard.GetDataObject()
Dim Text As String = Data.GetData(DataFormats.Text, True).ToString()
Data = Nothing
Return Text.Replace("'", "''")
Catch ex As Exception
Return "Error:"
Finally
File = Nothing
Doc.Close(NullObj, NullObj, NullObj)
NullObj = Nothing
End Try
|