Main Page | Report this Page
Computers Forum Index  »  Computer - CAD - Microstation (Programmers)  »  Access txt file replace text cell
Page 1 of 1    

Access txt file replace text cell

Author Message
Mel Arquiza
Posted: Tue Nov 22, 2005 2:46 am
Guest
Hi Anyone,

Can you able to tell how can I replace a text on a cell? from a text
file. Please let me know what is the problem in macro below. Thanks.

Sub GetText (nestLevel as integer,inElem as MbeElement)


dim gotElement as Integer
dim origin as MbePoint
dim elemText$
dim txt$
dim intLine As Integer
dim intFile As Integer

intFile = FreeFile

open "c:\textout_cell.txt" for input as #intFile


Do While gotElement = MBE_Success

If inElem.isHeader = TRUE Then

GetText nestLevel+1,inElem

gotElement = inElem.nextElement

Else

If inElem.type = MBE_Text Then


If inElem.getString (elemText) = MBE_Success Then
If inElem.getOrigin (origin) = MBE_Success Then

status = inElem.getstring(elemText)

intLine = 1

Do Until Not EOF(intFile)

line input #intFile, txt$
if(txt$ <> "") then

field$=item$(txt$,3,3)

if InStr(field$,elemText)>0 Then
field$ = elemText
status = inElem.setstring(elemText)
status = inElem.rewrite()
end if

end if

intLine = intLine + 1

Loop

'If you need to see the extracted text remove ' in front of
MbeMessageBox elemtext below

'MbeMessageBox elemtext


End If
End If

inElem.display MBE_Hilite

'If you need to change the color of the extracted text remove ' in front
of inElem.color = 4 below

'inElem.color = 4

End If

gotElement = inElem.nextComponent

End If


Loop

Close intFile

End sub

Thanks.


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
 
 
Page 1 of 1    
All times are GMT
The time now is Sun Mar 21, 2010 12:00 pm