rowbigred26
New Member
- Joined
- Mar 26, 2012
- Messages
- 5
Situation: I need 2010 Excel to take a list of stock symbols (changes daily) given to me daily, login to an internal company website and query our accounts to see who holds the stocks in question. I need the returned query to be copied back into excel for manipulation. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
<o
></o
>
I'm fairly green but adept at googling. So far I've been able to write code to login, input the symbol, and run the query. I'm unable to find the write code to copy the results and paste them back into excel. The results are always contained within the same html table, a sample of which is below. What can I write to tell vba to locate this table? I've tried getelementbyname and getelementbyID but keep coming up with blanks. I had some limited success with "by ID" and having vba show me the results in a msgBOX as a test but could not find this particular table. My concern is that there is a line break immediately following the td tag that precedes my results. Any suggestions?
I've tried (2 refers third to occurrence of ).:<o
></o
>
<o
></o
>
<o
></o
>




<o


I'm fairly green but adept at googling. So far I've been able to write code to login, input the symbol, and run the query. I'm unable to find the write code to copy the results and paste them back into excel. The results are always contained within the same html table, a sample of which is below. What can I write to tell vba to locate this table? I've tried getelementbyname and getelementbyID but keep coming up with blanks. I had some limited success with "by ID" and having vba show me the results in a msgBOX as a test but could not find this particular table. My concern is that there is a line break immediately following the td tag that precedes my results. Any suggestions?
HTML:
Results
johndoe started running Open Positions Tool (version 2.04 built April 6, 2011) at Thu Mar 29 09:49:26 CDT 2012
looking for positions in LIVETRADING_RETAIL REAL ABCClearing accounts with symbol=MGT
Found 1 accounts with this position
123456789ABCD,S,15.0,MGT,0.0,2464716,OPEN
Processing finished at Thu Mar 29 09:49:33 CDT 2012
I've tried (2 refers third to occurrence of ).:<o


<o


Code:
[FONT=Verdana][COLOR=black][COLOR=black][FONT=Verdana]Dim std as Str<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]std = Trim(doc.getElementsbyTagName("td")(2).innertext)<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]msgBox std<o:p></o:p>[/FONT][/COLOR]
[/COLOR][/FONT]


Last edited: