09-23-2020
02:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-23-2020
02:14 AM
Hi Chandra,
I am trying to create a text file which gets all part names in an assembly written, however I am struggling to
work out how to combine both write & read of my text file lines and only add the next part name if it doesn't already exist in previous lines.
Here is a basic example where I can check if the name exists - but I am unsure how to then activate the append function with it (you'll see it commented out below) so I can then add the name if its unique:
oFile = "C:\Temp\Names.txt" oRead = System.IO.File.OpenText(oFile) Dim sLine As String = "" Do sLine2 = ThisDoc.FileName(False) sLine = oRead.ReadLine() If Not sLine Is Nothing Then If sLine <> sLine2 Then ' oAppend = IO.File.AppendText("C:\TEMP2\Test_File.txt") ' oAppend.WriteLine(ThisDoc.FileName(False)) ' oAppend.Flush() ' oAppend.Close() MsgBox(sLine2) End If End If Loop Until sLine Is Nothing oRead.Close() ThisDoc.Launch(oFile)
Any help would be appreciated. Thanks @chandra.shekar.g