excel - Read specific string value from text file -


hi can please possible read specific value text file,

here input file,

config.txt

<databaseconnectionstring> "provider=sql;password=pa;persist security info=true;user id=s;initial catalog=l;data source=c.com" </databaseconnectionstring> 

i need text inside connection string tag in vba

here start, need go files or else fill initial string, dbc here in code :

sub minu_manjaly()  dim dbc string  dbc = cstr("<databaseconnectionstring>" & chr(34) & _         "provider=sql;password=pa;persist security info=true;user id=s;initial catalog=l;data source=c.com" & _         chr(34) & "</databaseconnectionstring>")  msgbox getdb_connect(dbc)  end sub 

and here function :

public function getdb_connect(byval db_connect_str string) string     dim cst string, _         starts long      starts = instr(1, db_connect_str, "<databaseconnectionstring>")      cst = mid(db_connect_str, starts + len("<databaseconnectionstring>"), _             instr(starts, db_connect_str, "</databaseconnectionstring>") - starts - len("</databaseconnectionstring>") + 1)      getdb_connect = cst end function 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -