Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Computer Aided Design - CAD > Programming with Microstation > Access txt fil...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 374 of 451
Post > Topic >>

Access txt file replace text cell

by "Mel Arquiza" <carquiza@[EMAIL PROTECTED] > Nov 22, 2005 at 02:46 AM

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




 1 Posts in Topic:
Access txt file replace text cell
"Mel Arquiza" &  2005-11-22 02:46:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 4 14:54:03 CDT 2008.