Expand|Select|Wrap|Line Numbers
- Private Sub Command5_Click()
- Dim rawHtml As String, tableChunk As String, tempFile As String
- Dim tmpAt As Long, tableStart As Long, tableEnd As Long
- rawHtml = GetPage(Me.webadd)
- ' Search forward until we're just before the table we want
- tmpAt = InStr(1, rawHtml, "<div class=""reservation-info"">")
- 'tmpAt = InStr(tmpAt, rawHtml, "<div class=""tableSection"">")
- ' Get the index of the start of the opening <table> tag
- tableStart = InStr(tmpAt, rawHtml, "<div class")
- ' Get the index of the end of the closing </table> tag
- tmpAt = InStr(tableStart, rawHtml, "</table")
- tableEnd = InStr(tmpAt, rawHtml, ">")
- ' Extract the table
- tableChunk = Mid(rawHtml, tableStart, tableEnd - tableStart + 1)
- ' Use native VBA file I/O
- tempFile = "C:\temp\tempTable.html"
- Open tempFile For Output As #1
- Write #1, tableChunk
- Close #1
- ' Import the file to a table
- DoCmd.TransferText acImportHTML, , "T_SQLTYPES", tempFile, True
- 'test from here
- Dim ie As InternetExplorer
- 'to refer to the HTML document returned
- Dim html As HTMLDocument
- 'open Internet Explorer in memory, and go to website
- Set ie = New InternetExplorer
- ie.Visible = True
- ie.Navigate "file:///C:/temp/tempTable.html"
- 'show text of HTML document returned
- Set html = ie.Document
- 'close down IE and reset status bar
- Set ie = Nothing
- 'Application.StatusBar = ""
- Dim QuestionList As IHTMLElement
- Set QuestionList = html.getElementsByName("reservation-info")
- Me.Text3.Value = QuestionList
- Me.Requery
- Me.Refresh
- ' Delete the temp file
- 'Kill tempFile
- DoCmd.OpenTable ("T_SQLTYPES")
- End Sub
Expand|Select|Wrap|Line Numbers
- "<div class=""reservation-info"">
- Name of Hotel · #603439460
- </div>
- </div> <!-- /span12 -->
- </div> <!-- /row -->
- <div class=""row-fluid"">
- <div class=""span6"">
- <table class=""table table-condensed table-striped table-hover table-bordered table-darkheader"">
- <tr>
- <th colspan=""3"" class=""booking-room"">Room 1</th>
- </tr>
- <tr>
- <td><b>Guest name</b></td>
- <td>
- <strong>
- Mr XXX
- </strong>
- </td>
- </tr>
- <tr><td>Checkin</td><td>14-05-2014</td></tr>
- <tr><td>Checkout</td><td>25-05-2014</td></tr>
- <tr>
- <td>Room type</td>
- <td>
- Double or Twin Room - Single Use
- </td>
- </tr>
- <tr>
- <td>Number of persons</td>
- <td>
- 1
- </td>
- </tr>
- <tr>
- <td>Arrival</td>
- <td>
- Wednesday, May 14, 2014
- </td>
- </tr>
- <tr>
- <td>Departure</td>
- <td>
- Sunday, May 25, 2014
- </td>
- </tr>
- <tr>
- <td>Number of nights</td>
- <td>
- 11
- </td>
- </tr>
- <tr>
- <td>
- Total costs
- (based on Single Use)
- </td>
- <td>
- EUR xxx
- <br>7 % VAT is included.
- </td>
- </tr>
- <tr>
- <td>Costs per night</td>
- <td>
- 18.80
- </td>
- </tr>
- <tr>
- <td>Costs per night for more than 1 person</td>
- <td>
- </td>
- </tr>
- <tr>
- <td>Status</td>
- <td>
- ok
- </td>
- </tr>
- <tr>
- <td>Smoking preference</td>
- <td>
- non-smoking
- </td>
- </tr>
- <tr>
- <td>Applicable Cancellation Policy</td>
- <td>
- If cancelled or modified up to 3 days before date of arrival, no fee will be charged.<br />
- If cancelled or modified later or in case of no-show, 100 percent of the total price of the reservation will be charged.<br />
- </td>
- </tr>
- <tr>
- <td>Applicable Deposit Policy</td>
- <td>
- The total price of the reservation will be charged at least 2 days prior to arrival.<br />
- </td>
- </tr>
- <tr>
- <td>Applicable Meal Plan</td>
- <td>Breakfast is included in the room rate.</td>
- </tr>
- </table>"
Name of Hotel · #603439460
</div> to be displayed either on my form Text3 or better still included in the table I am importing into Access. Any help would be appreciated. Thanks