And quick rules or tricks for recieving duplicate Classes off and Html page??-VBForums
Results 1 to 2 of 2

Thread: And quick rules or tricks for recieving duplicate Classes off and Html page??

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    51

    And quick rules or tricks for recieving duplicate Classes off and Html page??

    Does anyone know how to skip a class? or get all classes with the same class names into cells A B and C??

    Code:
    <tr>
    					<td class="headline txtBlue size15">
    						Model
    					</td>
                        <td style="width:10px">
    						&nbsp;
    					</td>
    					<td class="txtGrey size15">
                            Ford					</td>
    					<td>
    					</td>
    
    
    					<td class="headline txtBlue size15">
    						Year					</td>
    					<td class="txtGrey size15">
    						1967					</td>
    				</tr>
                    
                    <tr>
    					<td class="headline txtBlue size15">
    						Colour					</td>
                        <td style="width:10px">
    						&nbsp;
    					</td>
    					<td class="txtGrey size15">
                            Red					</td>
    					<td>
    					</td>
    MY CODE ( part of )

    Code:
    With objIE
    .Visible = False
    .navigate "http://www.sample.com/view.aspx?vehicle_id=F00293G"
    
    Do While .Busy Or _
    .readyState <> 4
    DoEvents
    Loop
    For Each ele In .document.all
    Select Case ele.classname
    Case "Result"
    RowCount = RowCount + 1
    Case "headline txtBlue size28"
    sht.Range("A" & RowCount) = ele.innertext
    Case "txtGrey size15"
    sht.Range("B" & RowCount) = ele.innertext
    Case "Location"
    sht.Range("C" & RowCount) = ele.innertext
    Case "Description"
    sht.Range("D" & RowCount) = ele.innertext
    End Select
    Next ele
    WHAT I REALLY WANT..

    Code:
    With objIE
    .Visible = False
    .navigate "http://www.sample.com/view.aspx?vehicle_id=F00293G"
    
    Do While .Busy Or _
    .readyState <> 4
    DoEvents
    Loop
    For Each ele In .document.all
    Select Case ele.classname
    Case "Result"
    RowCount = RowCount + 1
    Case "txtGrey size15"   '1ST ENTRY SAME VEHICLE    FORD
    sht.Range("A" & RowCount) = ele.innertext
    Case "txtGrey size15"   '2ND ENTRY SAME VEHICLE    1967
    sht.Range("B" & RowCount) = ele.innertext
    Case "txtGrey size15"   '3RD ENTRY SAME VEHICLE     RED
    sht.Range("C" & RowCount) = ele.innertext
    Case "txtGrey size15"   '4TH ENTRY SAME VEHICLE     AUTOMATIC
    sht.Range("D" & RowCount) = ele.innertext
    End Select
    Next ele
    is it +1 or (1) or after each??

    Anyone whos found a tutorial for handling this too would be great for this thread. Thanks.
    Last edited by 0o0o0; Feb 3rd, 2013 at 02:57 PM.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    19,892

    Re: And quick rules or tricks for recieving duplicate Classes off and Html page??

    without having seen the web page, i would be looking at working through each row in the table
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.