• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

£12 Travelodge Sale

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #21
    So this macro. It's written not directly in VB, but coded using captured keystrokes?

    Comment


      #22
      Originally posted by TimberWolf View Post
      So this macro. It's written not directly in VB, but coded using captured keystrokes?
      It's in VB. It uses a Web Query to loop around the dates and returns the data into individual sheets before combining the data into a table & running a pivot. As I said cludgy.
      What happens in General, stays in General.
      You know what they say about assumptions!

      Comment


        #23
        Originally posted by MarillionFan View Post
        It's in VB. It uses a Web Query to loop around the dates and returns the data into individual sheets before combining the data into a table & running a pivot. As I said cludgy.
        Cool, haven't used Web Query before, or Excel for ages for that matter.

        Pull data into Microsoft Excel with Web queries | TechRepublic

        Comment


          #24
          Where is DimPrawn to tell us that one must spend at least £3000/week on hotels.

          Comment


            #25
            Originally posted by TimberWolf View Post
            Where is DimPrawn to tell us that one must spend at least £3000/week on hotels.
            His hotel room doesn't have wifi.
            If your company is the best place to work in, for a mere £500 p/d, you can advertise here.

            Comment


              #26
              Originally posted by pmeswani View Post
              His hotel room doesn't have wifi.
              He's still got the breakfast dishes to wash.

              Comment


                #27
                I was going to combine in to one report but cannot be bothered. But basically this runs queries against the Travelodge site. Copy the code into a module in Excel and then run it.

                I am fairly certain one of the web developers on here could do a pretty cool bookmarklet to do something much more sophisticated.

                Code:
                Sub GetTravel()
                '
                ' GetTravel Macro
                '
                    Dim Sheetname As String
                    Dim Sheets(100) As String
                    Dim icnt As Integer
                    Dim Location As String
                    Dim SearchDate As Date
                    Dim StartDate As Date
                    Dim EndDate As Date
                    Dim GetStr As String
                '
                    Location = InputBox("Please type in a Travel Lodge Location")
                    StartDate = InputBox("Please enter start date")
                    EndDate = InputBox("Please enter end date")
                    SearchDate = Now
                    icnt = 0
                    
                    For i = DateValue(StartDate) To DateValue(EndDate) Step 7
                            Worksheets.Add
                            Sheetname = Format(i, "d") & "-" & Format(i, "mmm") & Format(i, "-yyyy")
                            For j = 1 To Worksheets.Count
                                If Worksheets(j).Name = Sheetname Then
                                    Application.DisplayAlerts = False
                                    Worksheets(Sheetname).Delete
                                    Application.DisplayAlerts = True
                                    Exit For
                                End If
                            Next j
                            ActiveSheet.Name = Sheetname
                            icnt = icnt + 1
                            Sheets(icnt) = Sheetname
                '
                        checkindate = Format(i, "d") & "%2F0" & Format(i, "mm") & "%2F" & Format(i, "yyyy")
                            GetStr = "URL;http://www.travelodge.co.uk/search_and_book/saver_search.php?action=search&tab=list&source=XX&search_for=PROM3&checkInDate=" & checkindate & "&locpostText=" & Location
                '    getstr = "URL;http://www.travelodge.co.uk/search_and_book/saver_search.php?action=search&tab=list&source=XX&search_for=PROM3&checkInDate=" & Str(i) & "%2F0" & Format(j, "00") & "%2F2012&locpostText=somerset"
                
                '
                        With ActiveSheet.QueryTables.Add(Connection:= _
                        GetStr _
                        , Destination:=Range("$A$1"))
                        .Name = "saver_search.php?action=search&tab=list&source=XX&search_for=PROM3&checkInDate=" & checkindate & "&locpostText=" & Location
                        .FieldNames = True
                        .RowNumbers = True
                        .FillAdjacentFormulas = False
                        .PreserveFormatting = True
                        .RefreshOnFileOpen = False
                        .BackgroundQuery = True
                        .RefreshStyle = xlInsertDeleteCells
                        .SavePassword = False
                        .SaveData = True
                        .AdjustColumnWidth = True
                        .RefreshPeriod = 0
                        .WebSelectionType = xlAllTables
                        .WebFormatting = xlWebFormattingNone
                        .WebPreFormattedTextToColumns = True
                        .WebConsecutiveDelimitersAsOne = True
                        .WebSingleBlockTextImport = False
                        .WebDisableDateRecognition = False
                        .WebDisableRedirections = False
                        .Refresh BackgroundQuery:=False
                        End With
                        Range("a1").Value = i
                        Range("a1").NumberFormat = "dd/mmm/yyyy"
                        ActiveCell.Offset(0, 2).Value = DateValue(Sheets(icnt)) - 3
                        ActiveCell.Offset(0, 3).Value = DateValue(Sheets(icnt)) - 2
                        ActiveCell.Offset(0, 4).Value = DateValue(Sheets(icnt)) - 1
                        ActiveCell.Offset(0, 5).Value = DateValue(Sheets(icnt)) - 0
                        ActiveCell.Offset(0, 6).Value = DateValue(Sheets(icnt)) + 1
                        ActiveCell.Offset(0, 7).Value = DateValue(Sheets(icnt)) + 2
                        ActiveCell.Offset(0, 8).Value = DateValue(Sheets(icnt)) + 3
                    Next
                 
                End Sub
                Last edited by MarillionFan; 16 April 2012, 19:54.
                What happens in General, stays in General.
                You know what they say about assumptions!

                Comment


                  #28
                  Originally posted by TimberWolf View Post
                  So this macro. It's written not directly in VB, but coded using captured keystrokes?
                  Basically yes - it's a key logger that will log your CUK password, online banking access etc...

                  Comment


                    #29
                    Originally posted by AtW View Post
                    Basically yes - it's a key logger that will log your CUK password, online banking access etc...
                    Ah, Russian humour must make dark cold winter nights fly by

                    Comment


                      #30
                      Originally posted by MarillionFan View Post
                      I was going to combine in to one report but cannot be bothered. But basically this runs queries against the Travelodge site. Copy the code into a module in Excel and then run it.

                      I am fairly certain one of the web developers on here could do a pretty cool bookmarklet to do something much more sophisticated.

                      Code:
                      Sub GetTravel()
                      '
                      ' GetTravel Macro
                      '
                          Dim Sheetname As String
                          Dim Sheets(100) As String
                          Dim icnt As Integer
                          Dim Location As String
                          Dim SearchDate As Date
                          Dim StartDate As Date
                          Dim EndDate As Date
                          Dim GetStr As String
                      '
                          Location = InputBox("Please type in a Travel Lodge Location")
                          StartDate = InputBox("Please enter start date")
                          EndDate = InputBox("Please enter end date")
                          SearchDate = Now
                          icnt = 0
                          
                          For i = DateValue(StartDate) To DateValue(EndDate) Step 7
                                  Worksheets.Add
                                  Sheetname = Format(i, "d") & "-" & Format(i, "mmm") & Format(i, "-yyyy")
                                  For j = 1 To Worksheets.Count
                                      If Worksheets(j).Name = Sheetname Then
                                          Application.DisplayAlerts = False
                                          Worksheets(Sheetname).Delete
                                          Application.DisplayAlerts = True
                                          Exit For
                                      End If
                                  Next j
                                  ActiveSheet.Name = Sheetname
                                  icnt = icnt + 1
                                  Sheets(icnt) = Sheetname
                      '
                              checkindate = Format(i, "d") & "%2F0" & Format(i, "mm") & "%2F" & Format(i, "yyyy")
                                  GetStr = "URL;http://www.travelodge.co.uk/search_and_book/saver_search.php?action=search&tab=list&source=XX&search_for=PROM3&checkInDate=" & checkindate & "&locpostText=" & Location
                      '    getstr = "URL;http://www.travelodge.co.uk/search_and_book/saver_search.php?action=search&tab=list&source=XX&search_for=PROM3&checkInDate=" & Str(i) & "%2F0" & Format(j, "00") & "%2F2012&locpostText=somerset"
                      
                      '
                              With ActiveSheet.QueryTables.Add(Connection:= _
                              GetStr _
                              , Destination:=Range("$A$1"))
                              .Name = "saver_search.php?action=search&tab=list&source=XX&search_for=PROM3&checkInDate=" & checkindate & "&locpostText=" & Location
                              .FieldNames = True
                              .RowNumbers = True
                              .FillAdjacentFormulas = False
                              .PreserveFormatting = True
                              .RefreshOnFileOpen = False
                              .BackgroundQuery = True
                              .RefreshStyle = xlInsertDeleteCells
                              .SavePassword = False
                              .SaveData = True
                              .AdjustColumnWidth = True
                              .RefreshPeriod = 0
                              .WebSelectionType = xlAllTables
                              .WebFormatting = xlWebFormattingNone
                              .WebPreFormattedTextToColumns = True
                              .WebConsecutiveDelimitersAsOne = True
                              .WebSingleBlockTextImport = False
                              .WebDisableDateRecognition = False
                              .WebDisableRedirections = False
                              .Refresh BackgroundQuery:=False
                              End With
                              Range("a1").Value = i
                              Range("a1").NumberFormat = "dd/mmm/yyyy"
                              ActiveCell.Offset(0, 2).Value = DateValue(Sheets(icnt)) - 3
                              ActiveCell.Offset(0, 3).Value = DateValue(Sheets(icnt)) - 2
                              ActiveCell.Offset(0, 4).Value = DateValue(Sheets(icnt)) - 1
                              ActiveCell.Offset(0, 5).Value = DateValue(Sheets(icnt)) - 0
                              ActiveCell.Offset(0, 6).Value = DateValue(Sheets(icnt)) + 1
                              ActiveCell.Offset(0, 7).Value = DateValue(Sheets(icnt)) + 2
                              ActiveCell.Offset(0, 8).Value = DateValue(Sheets(icnt)) + 3
                          Next
                       
                      End Sub
                      Worked for me. I've now only got 12 trial runs of MS Excel student edition left...

                      Comment

                      Working...
                      X