So this macro. It's written not directly in VB, but coded using captured keystrokes?
- 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
-
-
Originally posted by TimberWolf View PostSo this macro. It's written not directly in VB, but coded using captured keystrokes?What happens in General, stays in General.You know what they say about assumptions!Comment
-
Originally posted by MarillionFan View PostIt'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.
Pull data into Microsoft Excel with Web queries | TechRepublicComment
-
Comment
-
Originally posted by TimberWolf View PostWhere is DimPrawn to tell us that one must spend at least £3000/week on hotels.If your company is the best place to work in, for a mere £500 p/d, you can advertise here.Comment
-
Originally posted by pmeswani View PostHis hotel room doesn't have wifi.Comment
-
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
-
Originally posted by TimberWolf View PostSo this macro. It's written not directly in VB, but coded using captured keystrokes?Comment
-
Originally posted by AtW View PostBasically yes - it's a key logger that will log your CUK password, online banking access etc...Comment
-
Originally posted by MarillionFan View PostI 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
Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Streamline Your Retirement with iSIPP: A Solution for Contractor Pensions Sep 1 09:13
- Making the most of pension lump sums: overview for contractors Sep 1 08:36
- Umbrella company tribunal cases are opening up; are your wages subject to unlawful deductions, too? Aug 31 08:38
- Contractors, relabelling 'labour' as 'services' to appear 'fully contracted out' won't dupe IR35 inspectors Aug 31 08:30
- How often does HMRC check tax returns? Aug 30 08:27
- Work-life balance as an IT contractor: 5 top tips from a tech recruiter Aug 30 08:20
- Autumn Statement 2023 tipped to prioritise mental health, in a boost for UK workplaces Aug 29 08:33
- Final reminder for contractors to respond to the umbrella consultation (closing today) Aug 29 08:09
- Top 5 most in demand cyber security contract roles Aug 25 08:38
- Changes to the right to request flexible working are incoming, but how will contractors be affected? Aug 24 08:25
Comment