Hello
I need to create a database that receives mails with Word-attachments. When a mail arrives, it should be read line by line to find emailadresses, and then send mails to those adresses.
Is there an easy way to read attached Word-docs line by line in LotusScript?
Tx in advance.
Ken Janssen
Subject: LousScript Read lines from Word Document
You could extract the attachment to the disk and then read it.http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/5dbde906a992780c85256e66004cd045?OpenDocument
Then read it
Function readFile( fileName As String) As Variant
Dim data() As Variant
Dim lineData As String
Dim lines As Integer
Dim count As Integer
'*** get file num to read file
Dim fileNum As Integer
fileNum = Freefile
'*** open file
Open fileName For Input As fileNum
'*** get number of lines
lines = 0
Do While Not Eof( fileNum )
'*** Read each line of the file.
Line Input #fileNum, lineData
lines = lines + 1
Loop
'*** set file pointer back
Seek #fileNum, 1
'*** file array with the content of the file
count = 0
Redim data(0 To lines-1)
Do While Not Eof(fileNUM)
'*** Read each line of the file.
Line Input #fileNum, data( count )
count = count + 1
Loop
'*** close and delete the temp file
Close fileNum
readFile = data
End Function
But I am not sure how you want to catch any email address in a word document which is formated as word document.
Why not send a simple text files where you have on each line an email address?
Subject: RE: LousScript Read lines from Word Document
That’ll work for a plain text file, but probably not a Word document. To do that sort of thing with Word, you’d have to get into it with appropriate OLE classes and then…well, I’m not sure. I don’t know the Word object model well enough, but I’m pretty sure that reading a line at a time is something you won’t be able to do because, unlike a text file, Word docs just don’t think that way. You’ll have to read the VBA documentation in Word, because this is ultimately a question about Word, not Notes.
Subject: RE: LousScript Read lines from Word Document
Thanks for your responses, and indeed, I took a look at the VBA documentation and I think I can get it to work.
PS: It sure is simpeler to just use a text file, but I also need to extract part of the doc and create new docs from it… So VBA, here I come.
Thanks again!